diff --git a/locales.babel b/locales.babel new file mode 100644 index 00000000..33b3e21d --- /dev/null +++ b/locales.babel @@ -0,0 +1,51 @@ + + + + vue-json + locales.babel + + + + + false + + + en-US + + src/locales/en.json + + + zh-CN + + src/locales/zh.json + + + + + src/locales/en.json + + + src/locales/zh.json + + + + + $t('%1') + + + + + zh-CN + + tab + namespaced-json + + diff --git a/src/components/HelloI18n.vue b/src/components/HelloI18n.vue deleted file mode 100644 index 57ad6918..00000000 --- a/src/components/HelloI18n.vue +++ /dev/null @@ -1,17 +0,0 @@ - - - - - -{ - "en": { - "hello": "Hello i18n in SFC!" - } -} - diff --git a/src/locales/en.json b/src/locales/en.json index d9669836..0967ef42 100644 --- a/src/locales/en.json +++ b/src/locales/en.json @@ -1,3 +1 @@ -{ - "message": "hello i18n !!" -} \ No newline at end of file +{} diff --git a/src/locales/zh.json b/src/locales/zh.json index d9669836..0967ef42 100644 --- a/src/locales/zh.json +++ b/src/locales/zh.json @@ -1,3 +1 @@ -{ - "message": "hello i18n !!" -} \ No newline at end of file +{} diff --git a/src/main.js b/src/main.js index 59d06983..7dfc3857 100644 --- a/src/main.js +++ b/src/main.js @@ -1,5 +1,6 @@ // Vue import Vue from 'vue' +import i18n from './i18n' import App from './App' // 核心插件 import d2Admin from '@/plugin/d2admin' @@ -31,7 +32,6 @@ import d2VueFiltersDayjs from '@d2-admin/filters-dayjs' import router from './router' import { menuHeader, menuAside } from '@/menu' import { frameInRoutes } from '@/router/routes' -import i18n from './i18n' // 核心插件 Vue.use(d2Admin) @@ -52,8 +52,8 @@ Vue.component('VueUeditorWrap', VueUeditorWrap) new Vue({ router, store, + i18n, render: h => h(App), - created () { // 处理路由 得到每一级的路由设置 this.$store.commit('d2admin/page/init', frameInRoutes) @@ -62,7 +62,6 @@ new Vue({ // 初始化菜单搜索功能 this.$store.commit('d2admin/search/init', menuHeader) }, - mounted () { // 展示系统信息 this.$store.commit('d2admin/releases/versionShow') @@ -73,9 +72,6 @@ new Vue({ // 初始化全屏监听 this.$store.dispatch('d2admin/fullscreen/listen') }, - - i18n, - watch: { // 检测路由变化切换侧边栏内容 '$route.matched': { diff --git a/vue.config.js b/vue.config.js index c0431ad7..0d49e264 100644 --- a/vue.config.js +++ b/vue.config.js @@ -14,13 +14,10 @@ let publicPath = '/' module.exports = { // 根据你的实际情况更改这里 publicPath, - lintOnSave: true, - devServer: { publicPath // 和 publicPath 保持一致 }, - css: { loaderOptions: { // 设置 scss 公用变量文件 @@ -29,7 +26,6 @@ module.exports = { } } }, - // 默认设置: https://github.com/vuejs/vue-cli/tree/dev/packages/%40vue/cli-service/lib/config/base.js chainWebpack: config => { /** @@ -111,7 +107,7 @@ module.exports = { .end() } }, - + // i18n pluginOptions: { i18n: { locale: 'en',