little: 未做更改

This commit is contained in:
wf 2024-07-24 18:22:06 +08:00
parent 7294244d7d
commit 324a241319
3 changed files with 19 additions and 14 deletions

View File

@ -3,13 +3,10 @@ import { Directive } from "vue";
const custom: Directive = { const custom: Directive = {
mounted(el, binding, vnode) { mounted(el, binding, vnode) {
el.__onClick__ = () => { el.__onClick__ = () => {
binding.value(vnode.props); let { goodsId, event } = binding.value;
event(goodsId);
}; };
el.addEventListener("click", el.__onClick__); el.addEventListener("click", el.__onClick__);
},
beforeUnmount(el) {
// 解绑dom上的点击事件
el.removeEventListener("click", el.__onClick__);
} }
}; };

View File

@ -39,7 +39,7 @@ export const useThemeConfig = defineStore("theme-config", {
isBreadcrumb: true, // 面包屑渲染 isBreadcrumb: true, // 面包屑渲染
isTabs: true, // 标签栏渲染 isTabs: true, // 标签栏渲染
isFooter: true, // 页脚渲染 isFooter: true, // 页脚渲染
watermark: "SnowAdmin", // 水印 watermark: "", // 水印
watermarkStyle: { watermarkStyle: {
fontSize: 12, fontSize: 12,
color: "rgba(0, 0, 0, 0.15)" color: "rgba(0, 0, 0, 0.15)"

View File

@ -1,18 +1,26 @@
<template> <template>
<div class="dc-page"> <div class="dc-page">
<button v-custom="getFun" :goodsId="goodsId">文字变色</button> 测试指令
<!-- <button v-custom="{ goodsId, event: getFun }" :rowData="goodsId">文字变色</button> -->
</div> </div>
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
const goodsId = ref(100); // const goodsId = ref(100);
setTimeout(() => { // setTimeout(() => {
goodsId.value = 200; // goodsId.value = 200;
}, 1000); // }, 1000);
const getFun = (e: any) => { // setTimeout(() => {
console.log("点击事件", e); // goodsId.value = 300;
}; // }, 3000);
// setTimeout(() => {
// goodsId.value = 400;
// }, 4000);
// const getFun = (e: any) => {
// console.log("", e);
// };
</script> </script>
<style lang="scss" scoped></style> <style lang="scss" scoped></style>