chore: 组件卸载时移除emitter
This commit is contained in:
parent
41b69b5f93
commit
a70ae0f603
@ -1,7 +1,7 @@
|
||||
<script setup lang="ts">
|
||||
import type { UserProfile } from '#/api/system/profile/model';
|
||||
|
||||
import { onMounted, ref } from 'vue';
|
||||
import { onMounted, onUnmounted, ref } from 'vue';
|
||||
|
||||
import { Page } from '@vben/common-ui';
|
||||
import { useUserStore } from '@vben/stores';
|
||||
@ -34,7 +34,8 @@ async function handleUploadFinish() {
|
||||
userStore.setUserInfo(userInfo);
|
||||
}
|
||||
|
||||
emitter.on('updateProfile', loadProfile);
|
||||
onMounted(() => emitter.on('updateProfile', loadProfile));
|
||||
onUnmounted(() => emitter.off('updateProfile'));
|
||||
</script>
|
||||
|
||||
<template>
|
||||
|
@ -1,8 +1,13 @@
|
||||
<script setup lang="ts">
|
||||
import { onUnmounted } from 'vue';
|
||||
|
||||
import { Page } from '@vben/common-ui';
|
||||
|
||||
import DictDataPanel from './data/index.vue';
|
||||
import { emitter } from './mitt';
|
||||
import DictTypePanel from './type/index.vue';
|
||||
|
||||
onUnmounted(() => emitter.off('rowClick'));
|
||||
</script>
|
||||
|
||||
<template>
|
||||
|
Loading…
Reference in New Issue
Block a user