9
This commit is contained in:
7
src/lang/en_us.js
Normal file
7
src/lang/en_us.js
Normal file
@@ -0,0 +1,7 @@
|
||||
|
||||
// en_us.js文件
|
||||
export default {
|
||||
app: {
|
||||
hello: 'Hello,World!'
|
||||
}
|
||||
}
|
||||
36
src/lang/index.js
Normal file
36
src/lang/index.js
Normal file
@@ -0,0 +1,36 @@
|
||||
import Vue from 'vue'
|
||||
import VueI18n from 'vue-i18n'
|
||||
import {Locale} from 'vant'
|
||||
import enUS from 'vant/lib/locale/lang/en-US'
|
||||
import zhCN from 'vant/lib/locale/lang/zh-CN'
|
||||
import enLocale from './en_us'
|
||||
import zhLocale from './zh_cn'
|
||||
|
||||
Vue.use(VueI18n)
|
||||
|
||||
const messages = {
|
||||
en: {
|
||||
...enUS,
|
||||
...enLocale
|
||||
},
|
||||
zh: {
|
||||
...zhCN,
|
||||
...zhLocale
|
||||
}
|
||||
}
|
||||
|
||||
const i18n = new VueI18n({
|
||||
locale: 'zh', // 设置默认语言
|
||||
messages: messages // 设置资源文件对象
|
||||
})
|
||||
|
||||
// 更新vant组件库本身的语言变化,支持国际化
|
||||
function vantLocales (lang) {
|
||||
if (lang === 'en') {
|
||||
Locale.use(lang, enUS)
|
||||
} else if (lang === 'zh') {
|
||||
Locale.use(lang, zhCN)
|
||||
}
|
||||
}
|
||||
|
||||
export {i18n, vantLocales}
|
||||
6
src/lang/zh_cn.js
Normal file
6
src/lang/zh_cn.js
Normal file
@@ -0,0 +1,6 @@
|
||||
// zh_cn.js文件
|
||||
export default {
|
||||
app: {
|
||||
hello: '你好,世界!'
|
||||
}
|
||||
}
|
||||
@@ -138,8 +138,9 @@ const transform: AxiosTransform = {
|
||||
if(config.url && config.url.endsWith("domain.txt")){
|
||||
return config
|
||||
}else if(domain && domain.length > 0){
|
||||
let domainUrl = domain[Math.floor((Math.random()*domain.length))];
|
||||
config.url = domainUrl + config.url;
|
||||
// let domainUrl = domain[Math.floor((Math.random()*domain.length))];
|
||||
// config.url = domainUrl + config.url;
|
||||
// config.url = domainUrl + config.url;
|
||||
}else if(apiUrl && isString(apiUrl)){
|
||||
config.url = `${apiUrl}${config.url}`;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user