diff --git a/src/api/tag/tag.js b/src/api/tag/tag.js new file mode 100644 index 0000000..70d7764 --- /dev/null +++ b/src/api/tag/tag.js @@ -0,0 +1,11 @@ +import http from "@/utils/http"; +//获取标签名 +export const getTags= (tagName)=>{ + return http({ + url:"/tag/getTags", + method:"get", + params:{ + tagName + }, + }) +} \ No newline at end of file diff --git a/src/utils/debounceRef.js b/src/utils/debounceRef.js new file mode 100644 index 0000000..aca4baf --- /dev/null +++ b/src/utils/debounceRef.js @@ -0,0 +1,24 @@ +import { customRef } from "vue"; +/** + * 防抖Ref + * @param {} value + * @param {*} delay + * @returns + */ +export const debounceRef = (value, delay = 1000) => { + let timeout; + return customRef((track,trigger)=>({ + get () { + track(); + return value; + }, + set (val) { + clearTimeout(timeout); + timeout = setTimeout(() => { + value = val; + trigger(); + }, delay); + } + })) + +};