提交 1b3ac313 作者: 方治民

chore(config): 更新 app log 输出样式

上级 ad68a92f
import type { App } from 'vue'
const config: Application = {
name: __APP__.name,
version: __APP__.version,
......@@ -8,16 +10,20 @@ const config: Application = {
export const $app = config
export function setupAppConfig() {
export function setupAppConfig(app: App<Element>) {
// 打印 App 信息
const block = Array(50).fill('=').join('')
const infos: string[] = []
infos.push(block)
infos.push(`[App] name: ${config.name}`)
infos.push(`[App] version: ${config.version}`)
infos.push(`[App] description: ${config.description}`)
infos.push(`[App] author: ${config.author.name} ${config.author.url}`)
infos.push(`[App] lastBuildTime: ${config.lastBuildTime}`)
infos.push(block)
console.log('%c' + infos.join('\n'), 'color: violet;')
console.log(
`%c APP %c ${config.name} %c V${config.version} `,
'padding: 2px 1px; border-radius: 3px; color: #fff; background: #fa593b; font-weight: bold; margin-right: 5px;',
'padding: 2px 1px; border-radius: 3px 0 0 3px; color: #fff; background: #606060; font-weight: bold;',
'padding: 2px 1px; border-radius: 0 3px 3px 0; color: #fff; background: #42c02e; font-weight: bold;',
)
app.config.globalProperties.$app = $app
}
declare module '@vue/runtime-core' {
interface ComponentCustomProperties {
$app: Application
}
}
......@@ -25,8 +25,8 @@ if (isDevMode()) {
async function bootstrap() {
const app = createApp(App)
// App 配置
setupAppConfig()
// 注册 App 配置
setupAppConfig(app)
// Configure store
// 配置 store
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论