Bladeren bron

修改客户资料 stop effect

huangbin 4 jaren geleden
bovenliggende
commit
d35c6cc391

+ 5 - 2
src/views/information/custom/list/normal-use/index.vue

@@ -29,7 +29,7 @@
 </template>
 
 <script lang="ts">
-import { defineComponent, Ref, ref, watchEffect } from 'vue';
+import { defineComponent, onUnmounted, Ref, ref, watchEffect } from 'vue';
 
 import { initData } from '@/setup/methods/index';
 import filterCustomTable from '@/views/information/custom/compoments/filterTable/index.vue';
@@ -83,10 +83,13 @@ export default defineComponent({
         const { modifyAction } = handleModify(contextMenuList);
         const { disableAction } = handleDisable(contextMenuList);
 
-        watchEffect(() => {
+        const stop = watchEffect(() => {
             hasPermission('custom_info_btn_modify') && modifyAction();
             hasPermission('custom_info_btn_disable') && disableAction();
         });
+        onUnmounted(() => {
+            stop();
+        });
         initData(() => {
             actionQuery(3);
             getColumns();

+ 5 - 2
src/views/information/custom/list/stop-use/index.vue

@@ -30,7 +30,7 @@
 </template>
 
 <script lang="ts">
-import { defineComponent, Ref, ref, watchEffect } from 'vue';
+import { defineComponent, onUnmounted, Ref, ref, watchEffect } from 'vue';
 
 import { initData } from '@/setup/methods/index';
 import filterCustomTable from '@/views/information/custom/compoments/filterTable/index.vue';
@@ -84,10 +84,13 @@ export default defineComponent({
         const { deleteAction } = handleDelete(contextMenuList);
         const { recoverAction } = handleRecover(contextMenuList);
 
-        watchEffect(() => {
+        const stop = watchEffect(() => {
             hasPermission('custom_info_btn_recover') && recoverAction();
             hasPermission('custom_info_btn_delete') && deleteAction();
         });
+        onUnmounted(() => {
+            stop();
+        });
         initData(() => {
             actionQuery(4);
             getColumns();