feat: 更新 PrimeVue 配置以支持多语言,移除不必要的代码
This commit is contained in:
@ -1,10 +1,4 @@
|
||||
<script setup lang="ts">
|
||||
import { usePrimeVue } from 'primevue/config';
|
||||
import zhCN from 'primelocale/zh-CN.json';
|
||||
|
||||
const primevue = usePrimeVue();
|
||||
primevue.config.locale = zhCN['zh-CN'];
|
||||
</script>
|
||||
<script setup lang="ts"></script>
|
||||
|
||||
<template>
|
||||
<div class="primevue">
|
||||
|
16
src/main.ts
16
src/main.ts
@ -6,12 +6,13 @@ import { createHead } from '@unhead/vue';
|
||||
import piniaPluginPersistedstate from 'pinia-plugin-persistedstate';
|
||||
|
||||
import { DataLoaderPlugin } from 'unplugin-vue-router/data-loaders';
|
||||
import { createI18n } from 'vue-i18n';
|
||||
import App from './App.vue';
|
||||
import { router } from './router';
|
||||
import { createI18n } from 'vue-i18n';
|
||||
|
||||
import PrimeVue from 'primevue/config';
|
||||
import Aura from '@primevue/themes/aura';
|
||||
import zhCN from 'primelocale/zh-CN.json';
|
||||
import PrimeVue from 'primevue/config';
|
||||
|
||||
/* https://github.com/intlify/bundle-tools/tree/main/packages/unplugin-vue-i18n#static-bundle-importing
|
||||
* All i18n resources specified in the plugin `include` option can be loaded
|
||||
@ -48,12 +49,11 @@ async function init() {
|
||||
locale: navigator.language,
|
||||
messages,
|
||||
}),
|
||||
);
|
||||
app.use(PrimeVue, {
|
||||
theme: {
|
||||
preset: Aura,
|
||||
},
|
||||
});
|
||||
)
|
||||
.use(PrimeVue, {
|
||||
locale: zhCN['zh-CN'], // usePrimeVue().config.locale
|
||||
theme: { preset: Aura },
|
||||
});
|
||||
app.config.globalProperties.$__DEV__ = $__DEV__;
|
||||
app.mount('#app');
|
||||
}
|
||||
|
Reference in New Issue
Block a user