🐛(i18n): 修复按需加载下 i18n 的注册问题

This commit is contained in:
sight
2022-05-15 17:03:00 +08:00
parent 334699b210
commit 5a05c3a621
7 changed files with 24 additions and 11 deletions

View File

@@ -1,15 +1,11 @@
import type { App, Plugin } from "vue";
import i18n from "../language";
import { App, Plugin } from "vue";
export type WithInstallType<T> = T & Plugin;
export const withInstall = <T>(comp: T): T & Plugin => {
const component = comp as any;
component.install = (app: App | any) => {
if (!app.__VUE_I18N_SYMBOL__) {
app.use(i18n);
}
component.install = (app: App) => {
app.component(component.name, comp);
};