Files
shanxia2.0/web-admin/src/main.ts
T
2026-08-03 12:48:52 +08:00

64 lines
2.0 KiB
TypeScript

import './utils/patch-el-select-filterable'
import App from './App.vue'
import { createApp } from 'vue'
import { ElTable } from 'element-plus'
import EmptyAwareElTag from './utils/patch-el-tag-empty'
import ListTable from '@/components/business/list-table/index.vue'
ElTable.props.border = { type: Boolean, default: true }
import { initStore } from './store' // Store
import { initRouter } from './router' // Router
import language from './locales' // 国际化
import '@styles/core/tailwind.css' // tailwind
import '@styles/index.scss' // 样式
import '@utils/sys/console.ts' // 控制台输出内容
import { setupGlobDirectives } from './directives'
import { setupErrorHandle } from './utils/sys/error-handle'
function maskSecret(value?: string) {
if (!value) return '(empty)'
if (value.length <= 6) return '*'.repeat(value.length)
return `${value.slice(0, 3)}***${value.slice(-3)}`
}
function logApiCryptoBootInfo() {
const {
VITE_API_ENCRYPT_ENABLED,
VITE_API_ENCRYPT_FAIL_OPEN,
VITE_API_ENCRYPT_FIXED_SECRET,
VITE_API_ENCRYPT_EXCLUDE_PATHS
} = import.meta.env
const excludeCount = String(VITE_API_ENCRYPT_EXCLUDE_PATHS || '')
.split(',')
.map((item) => item.trim())
.filter(Boolean).length
console.info(
'[API_CRYPTO_BOOT] enabled=%s failOpen=%s fixedSecret=%s excludeCount=%s mode=%s',
String(VITE_API_ENCRYPT_ENABLED || 'false'),
String(VITE_API_ENCRYPT_FAIL_OPEN || 'true'),
maskSecret(String(VITE_API_ENCRYPT_FIXED_SECRET || '')),
excludeCount,
import.meta.env.MODE
)
}
document.addEventListener(
'touchstart',
function () {},
{ passive: false }
)
logApiCryptoBootInfo()
const app = createApp(App)
app.component('ElTag', EmptyAwareElTag)
// 列表列宽拖拽持久化:全局注册,避免按需解析失败导致部分页仍是裸标签
app.component('ListTable', ListTable)
initStore(app)
initRouter(app)
setupGlobDirectives(app)
setupErrorHandle(app)
app.use(language)
app.mount('#app')