This commit is contained in:
虾壳 2024-07-17 19:37:16 +08:00
parent ccfee1d011
commit ed69b64f3c
2 changed files with 35 additions and 0 deletions

11
src/api/tag/tag.js Normal file
View File

@ -0,0 +1,11 @@
import http from "@/utils/http";
//获取标签名
export const getTags= (tagName)=>{
return http({
url:"/tag/getTags",
method:"get",
params:{
tagName
},
})
}

24
src/utils/debounceRef.js Normal file
View File

@ -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);
}
}))
};