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