1、通过npm安装vue-i18n
npm install vue-i18n --save-dev
2、创建cn.js和en.js文件
//cn.js
module.exports = {
user: {
msg: '生活的道路一旦选定,就要勇敢知地走到底,决不回头。'
}
}
//en.js
module.exports = {
user: {
msg: 'Once the road of life is chosen, we should go to the end bravely and never look back.'
}
}
3、建立js文件,将cn.js和en.js引入
import Vue from 'vue'
import VueI18n from 'vue-i18n'
import en from './en.js'
import cn from './cn.js'
Vue.use(VueI18n)
const messages =