Commit 97864cc3 by haojie

1

parent 749753c7
...@@ -5,14 +5,14 @@ ...@@ -5,14 +5,14 @@
:bordered="true" :bordered="true"
v-model="locale" v-model="locale"
:options="languageOptions" :options="languageOptions"
@Change="changeLanguage" :onChange="changeLanguage"
:borderless="true" :borderless="true"
></t-select> ></t-select>
</div> </div>
</template> </template>
<script lang="ts" setup> <script lang="ts" setup>
import { useI18n } from '#imports'; import { useI18n } from 'vue-i18n';
const props = defineProps({ const props = defineProps({
type: { type: {
type: String, type: String,
......
import { ref } from 'vue'; import { ref } from 'vue';
import { useI18n } from 'vue-i18n';
import { TableSort } from '@/utils/tool'; import { TableSort } from '@/utils/tool';
import { useI18n } from '#imports';
export default function () { export default function () {
const { t } = useI18n(); const { t } = useI18n();
const otherLink = ref([ const otherLink = ref([
......
import cn from '../language/cn';
import en from '../language/en';
const i18n = {
locales: ['cn', 'en'], //有多少地区的语言就添加多少种
defaultLocale: 'en', //默认的地区语言
vueI18n: {
fallbackLocale: 'en', //回退策略,指定的locale中没有找到对应资源的情况下使用的locale
messages: {
//要渲染的信息,有多少语言就添加多少种
cn: cn,
en: en,
},
},
};
export default i18n;
import viteCompression from 'vite-plugin-compression'; import viteCompression from 'vite-plugin-compression';
import i18n from './language/i18n';
// 筛选接口地址 // 筛选接口地址
let filterApi = 'http://156.247.9.93:9501/'; let filterApi = 'http://156.247.9.93:9501/';
let loginApi = 'http://156.247.9.93:8001/'; let loginApi = 'http://156.247.9.93:8001/';
export default defineNuxtConfig({ export default defineNuxtConfig({
// plugins: [], // plugins: [],
modules: ['nuxt-svgo', '@nuxtjs-alt/proxy', '@nuxtjs/i18n'], modules: ['nuxt-svgo', '@nuxtjs-alt/proxy'],
i18n: {
// ...
...i18n,
detectBrowserLanguage: {
useCookie: true,
cookieKey: 'i18n_redirected',
redirectOn: 'root', // recommended
},
},
proxy: { proxy: {
enableProxy: true, enableProxy: true,
proxies: { proxies: {
...@@ -80,7 +70,7 @@ export default defineNuxtConfig({ ...@@ -80,7 +70,7 @@ export default defineNuxtConfig({
// 第三方插件转es5 // 第三方插件转es5
transpile: transpile:
process.env.NODE_ENV === 'production' process.env.NODE_ENV === 'production'
? ['tdesign-vue-next', 'echarts'] ? ['tdesign-vue-next', 'echarts', 'vue-i18n']
: ['echarts'], : ['echarts'],
// cssSourceMap: true, // cssSourceMap: true,
}, },
......
This source diff could not be displayed because it is too large. You can view the blob instead.
...@@ -10,7 +10,6 @@ ...@@ -10,7 +10,6 @@
"postinstall": "nuxt prepare" "postinstall": "nuxt prepare"
}, },
"devDependencies": { "devDependencies": {
"@nuxt/types": "^2.16.0",
"axios": "^0.24.0", "axios": "^0.24.0",
"cross-env": "^7.0.3", "cross-env": "^7.0.3",
"fontmin": "^0.9.9", "fontmin": "^0.9.9",
...@@ -22,7 +21,6 @@ ...@@ -22,7 +21,6 @@
"dependencies": { "dependencies": {
"@metamask/detect-provider": "^2.0.0", "@metamask/detect-provider": "^2.0.0",
"@nuxtjs-alt/proxy": "^2.0.4", "@nuxtjs-alt/proxy": "^2.0.4",
"@nuxtjs/i18n": "^7.3.1",
"echarts": "^5.4.0", "echarts": "^5.4.0",
"ethers": "^5.7.2", "ethers": "^5.7.2",
"install": "^0.13.0", "install": "^0.13.0",
...@@ -31,6 +29,7 @@ ...@@ -31,6 +29,7 @@
"qrcode": "^1.5.1", "qrcode": "^1.5.1",
"tdesign-icons-vue-next": "^0.1.7", "tdesign-icons-vue-next": "^0.1.7",
"tdesign-vue-next": "^0.25.0", "tdesign-vue-next": "^0.25.0",
"vue-clipboard3": "^1.0.1" "vue-clipboard3": "^1.0.1",
"vue-i18n": "^9.2.2"
} }
} }
import { defineNuxtPlugin } from '#app';
import i18n from '@/language/index';
export default defineNuxtPlugin((nuxtApp) => {
nuxtApp.vueApp.use(i18n);
});
{ {
// https://nuxt.com/docs/guide/concepts/typescript // https://nuxt.com/docs/guide/concepts/typescript
"extends": "./.nuxt/tsconfig.json", "extends": "./.nuxt/tsconfig.json"
"compilerOptions": {
"types": ["@nuxt/types", "@nuxtjs/i18n"]
}
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment