1
0
mirror of https://github.com/zclzone/vue-naive-admin.git synced 2026-01-22 23:50:22 +08:00

style: lint

This commit is contained in:
zclzone
2024-06-06 18:05:36 +08:00
parent 98f9d5893a
commit a67510fe34
72 changed files with 542 additions and 389 deletions

View File

@@ -27,14 +27,15 @@
</template>
<script setup>
import { zhCN, dateZhCN, darkTheme } from 'naive-ui'
import { darkTheme, dateZhCN, zhCN } from 'naive-ui'
import { LayoutSetting } from '@/components'
import { useAppStore, useTabStore } from '@/store'
const layouts = new Map()
function getLayout(name) {
// 利用map将加载过的layout缓存起来防止重新加载layout导致页面闪烁
if (layouts.get(name)) return layouts.get(name)
if (layouts.get(name))
return layouts.get(name)
const layout = markRaw(defineAsyncComponent(() => import(`@/layouts/${name}/index.vue`)))
layouts.set(name, layout)
return layout
@@ -42,15 +43,17 @@ function getLayout(name) {
const route = useRoute()
const appStore = useAppStore()
if (appStore.layout === 'default') appStore.setLayout('')
if (appStore.layout === 'default')
appStore.setLayout('')
const Layout = computed(() => {
if (!route.matched?.length) return null
if (!route.matched?.length)
return null
return getLayout(route.meta?.layout || appStore.layout)
})
const tabStore = useTabStore()
const keepAliveNames = computed(() => {
return tabStore.tabs.filter((item) => item.keepAlive).map((item) => item.name)
return tabStore.tabs.filter(item => item.keepAlive).map(item => item.name)
})
watchEffect(() => {