yedea-plugins
v1.3.1
Published
```bash npm install yedea-plugins ```
Readme
npm install yedea-pluginsimport { ProdHiddenPlugin } from 'yedea-plugins';ProdHiddenPlugin
import { ProdHiddenPlugin } from 'yedea-plugins';
import VConsole from 'vconsole';
const vconsole = new VConsole();
vconsole.addPlugin(ProdHiddenPlugin);说明
在 main.js 中引入后会隐藏 vconsole 连续点击 8 次以上后长按 8s 出现 vconsole 的插件
enterKey
export { enterKey } from 'yedea-plugins';
app.directive('enterKey', enterKey);<template>
<div @click="ok">click me</div>
</template>// main.js
const ok = () => {
console.log('ok');
};说明
自定义指令 绑定到 dom 元素后 元素点击事件可以通过键盘回车时间触发
debounce
// main.js
export { debounce } from 'yedea-plugins';
app.directive('debounce', debounce);<div v-debounce="ok" v-enterKey>ok</div><div v-debounce="{func:ok,delay:3000}" v-enterKey>ok</div>说明
自定义指令 绑定到 dom 元素后 元素在防抖时间内连续点击只出发一次.默认 2s,修改延迟时间通过 {func:ok,delay:3000} 传入
useAxios
<template>
<button :loading="loading" type="primary" @click="fectchAxios">发送</button>
{{ loading }}
{{ data }}
{{ error }}
</template>
<script setup>
import { useAxios } from 'yedea-plugins';
const testApi = function () {
return new Promise((resolve, reject) => {
setTimeout(() => {
resolve({
data: 'hello world',
});
}, 2000);
});
};
const { fetch, data, loading, error } = useAxios(testApi);
const fectchAxios = () => {
fetch();
};
</script>

