feat: 对话标题
This commit is contained in:
@@ -84,7 +84,7 @@
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { computed, ref, nextTick } from 'vue'
|
||||
import { computed, ref, nextTick, onMounted, onUnmounted } from 'vue'
|
||||
import { useRoute, useRouter } from 'vue-router'
|
||||
import { useI18n } from 'vue-i18n'
|
||||
import { getProjectList, updateProject, deleteProject } from '@/api/agent'
|
||||
@@ -93,7 +93,8 @@
|
||||
const { t: $t } = useI18n()
|
||||
const route = useRoute()
|
||||
const router = useRouter()
|
||||
import { useGlobalStore } from '@/stores'
|
||||
import { useGlobalStore, useProjectStore } from '@/stores'
|
||||
const projectStore = useProjectStore()
|
||||
const id = computed(() => route.params.id)
|
||||
const globalStore = useGlobalStore()
|
||||
const isCollapse = computed(() => globalStore.state.homeLeftNavCollapse)
|
||||
@@ -198,8 +199,22 @@
|
||||
}
|
||||
MyEvent.add('updateProjectList', GetProjectList)
|
||||
GetProjectList()
|
||||
|
||||
const replaceTitle = (title: string) => {
|
||||
list.value.forEach((item: any) => {
|
||||
if (String(item.id) === String(projectStore.state.id)) {
|
||||
item.name = title
|
||||
}
|
||||
})
|
||||
}
|
||||
onMounted(() => {
|
||||
MyEvent.add('newTitle', replaceTitle)
|
||||
})
|
||||
onUnmounted(() => {
|
||||
MyEvent.remove('newTitle', replaceTitle)
|
||||
})
|
||||
</script>
|
||||
|
||||
|
||||
<style lang="less" scoped>
|
||||
.left-nav {
|
||||
width: var(--left-nav-collapse-width, 30rem);
|
||||
|
||||
Reference in New Issue
Block a user