mirror of
https://gitee.com/dromara/go-view.git
synced 2026-04-23 00:00:12 +08:00
feat: 新增tab名称跟随项目名称
This commit is contained in:
@@ -30,9 +30,13 @@
|
||||
|
||||
<script setup lang="ts">
|
||||
import { ref, nextTick, computed } from 'vue'
|
||||
import { fetchRouteParamsLocation } from '@/utils'
|
||||
import { fetchRouteParamsLocation, setTitle } from '@/utils'
|
||||
import { useChartEditStore } from '@/store/modules/chartEditStore/chartEditStore'
|
||||
import { EditCanvasConfigEnum } from '@/store/modules/chartEditStore/chartEditStore.d'
|
||||
import { icon } from '@/plugins'
|
||||
|
||||
const { FishIcon } = icon.ionicons5
|
||||
const chartEditStore = useChartEditStore()
|
||||
|
||||
const focus = ref<boolean>(false)
|
||||
const inputInstRef = ref(null)
|
||||
@@ -51,7 +55,10 @@ const title = ref<string>(fetchProhectInfoById() || '')
|
||||
const comTitle = computed(() => {
|
||||
// eslint-disable-next-line vue/no-side-effects-in-computed-properties
|
||||
title.value = title.value.replace(/\s/g, '')
|
||||
return title.value.length ? title.value : '新项目'
|
||||
const newTitle = title.value.length ? title.value : '新项目'
|
||||
setTitle(`工作空间-${newTitle}`)
|
||||
chartEditStore.setEditCanvasConfig(EditCanvasConfigEnum.PROJECT_NAME, newTitle)
|
||||
return newTitle
|
||||
})
|
||||
|
||||
const handleFocus = () => {
|
||||
|
||||
@@ -38,7 +38,7 @@ import { MonacoEditor } from '@/components/Pages/MonacoEditor'
|
||||
import { SavePageEnum } from '@/enums/editPageEnum'
|
||||
import { getSessionStorageInfo } from '../preview/utils'
|
||||
import type { ChartEditStorageType } from '../preview/index.d'
|
||||
import { setSessionStorage, JSONStringify, JSONParse } from '@/utils'
|
||||
import { setSessionStorage, JSONStringify, JSONParse, setTitle } from '@/utils'
|
||||
import { StorageEnum } from '@/enums/storageEnum'
|
||||
import { icon } from '@/plugins'
|
||||
|
||||
@@ -48,6 +48,7 @@ const content = ref('')
|
||||
// 从sessionStorage 获取数据
|
||||
async function getDataBySession() {
|
||||
const localStorageInfo: ChartEditStorageType = await getSessionStorageInfo() as unknown as ChartEditStorageType
|
||||
setTitle(`编辑-${localStorageInfo.editCanvasConfig.projectName}`)
|
||||
content.value = JSONStringify(localStorageInfo)
|
||||
}
|
||||
setTimeout(getDataBySession)
|
||||
|
||||
@@ -29,7 +29,7 @@
|
||||
<script setup lang="ts">
|
||||
import { computed } from 'vue'
|
||||
import { PreviewRenderList } from './components/PreviewRenderList'
|
||||
import { getFilterStyle } from '@/utils'
|
||||
import { getFilterStyle, setTitle } from '@/utils'
|
||||
import { getEditCanvasConfigStyle, getSessionStorageInfo } from './utils'
|
||||
import { useComInstall } from './hooks/useComInstall.hook'
|
||||
import { useScale } from './hooks/useScale.hook'
|
||||
@@ -38,6 +38,7 @@ import { PreviewScaleEnum } from '@/enums/styleEnum'
|
||||
import type { ChartEditStorageType } from './index.d'
|
||||
|
||||
const localStorageInfo: ChartEditStorageType = getSessionStorageInfo() as ChartEditStorageType
|
||||
setTitle(`预览-${localStorageInfo.editCanvasConfig.projectName}`)
|
||||
|
||||
const previewRefStyle = computed(() => {
|
||||
return {
|
||||
|
||||
Reference in New Issue
Block a user