feat: 初次提交我的项目代码
This commit is contained in:
10
main.uts
10
main.uts
@@ -6,9 +6,13 @@ export function createApp() {
|
||||
const app = createSSRApp(App)
|
||||
|
||||
// 注册 i18n 全局属性,使组件可以使用 $t 方法
|
||||
app.config.globalProperties.$t = (key: string, values?: any, locale?: string): string => {
|
||||
return i18n.global.t(key, values, locale)
|
||||
}
|
||||
app.config.globalProperties.$t = (key: string, values?: any, locale?: string): string => {
|
||||
if (!i18n.global) {
|
||||
console.error('i18n is not initialized')
|
||||
return key
|
||||
}
|
||||
return i18n.global.t(key, values, locale) || key
|
||||
}
|
||||
|
||||
return { app }
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user