20260819173221
This commit is contained in:
1 parent
1ffc8e1ac9
commit
a0a4273f4c
326 files changed
+301646
-2314
No files matched your search
@@ -2,12 +2,14 @@ import { createApp } from 'vue'
|
||||
import { createPinia } from 'pinia'
|
||||
import piniaPluginPersistedstate from 'pinia-plugin-persistedstate'
|
||||
import './styles/index.css'
|
||||
import './styles/demo.css'
|
||||
import 'stk-table-vue/lib/style.css'
|
||||
import { registerFeature, useAreaSelection } from 'stk-table-vue'
|
||||
import App from './App.vue'
|
||||
import router from './router'
|
||||
import { initThemeSync } from './stores/app'
|
||||
import { useAuthStore } from '@/stores/auth'
|
||||
import { usePermissionStore } from '@/stores/permissions'
|
||||
|
||||
// stk-table 按需特性注册:单元格区域选择(FmsTable 的行编辑依赖 area-selection 事件)
|
||||
registerFeature(useAreaSelection)
|
||||
|
||||
const pinia = createPinia()
|
||||
pinia.use(piniaPluginPersistedstate)
|
||||
@@ -40,14 +42,8 @@ async function bootstrap() {
|
||||
try {
|
||||
await router.isReady()
|
||||
|
||||
// 登录态下,首屏需要先准备好菜单/权限数据再挂载布局,
|
||||
// 否则挂载后菜单异步到达会“跳出”(对齐 cool-admin:菜单加载放在 mount 之前)
|
||||
const authStore = useAuthStore()
|
||||
if (authStore.isAuthenticated) {
|
||||
const permissionStore = usePermissionStore()
|
||||
await permissionStore.load().catch(() => {})
|
||||
}
|
||||
|
||||
// 权限数据由路由守卫(beforeEach)统一加载:首屏 beforeEach 在 mount 前 await 完成,
|
||||
// 菜单一次性到位、不会“跳出”(对齐 cool-admin:菜单加载放在 mount 之前)
|
||||
// 先把 boot 屏移出 #app,避免被 mount 整体替换而瞬间消失(那样没有过渡且会卡顿)
|
||||
const boot = document.querySelector('#app-boot')
|
||||
if (boot) document.body.appendChild(boot)
|
||||
@@ -62,10 +58,15 @@ async function bootstrap() {
|
||||
})
|
||||
|
||||
if (boot) {
|
||||
boot.addEventListener('transitionend', () => boot.remove(), { once: true })
|
||||
// 移除 boot 屏并清理加载屏的临时主题类(主题由 applyDarkMode 的 .dark 统一管理)
|
||||
const cleanupBoot = () => {
|
||||
boot.remove()
|
||||
document.documentElement.classList.remove('boot-dark')
|
||||
}
|
||||
boot.addEventListener('transitionend', cleanupBoot, { once: true })
|
||||
// 兜底:防止 transitionend 未触发导致节点残留
|
||||
setTimeout(() => {
|
||||
if (boot.isConnected) boot.remove()
|
||||
if (boot.isConnected) cleanupBoot()
|
||||
}, 600)
|
||||
}
|
||||
} catch (error) {
|
||||
|
||||
Reference in new issue
Block a user