在开发中经常遇到的问题,引入Element.ui框架使用时发现有时引入的是英文版,这对于我们做中文后台肯定不行,查了资料找到切换中文的办法,仅作笔记。
1、首先在找到plugins目录下element-ui.js文件,内容如下:
import Vue from 'vue'
import Element from 'element-ui'
import locale from 'element-ui/lib/locale/lang/zh-CN' // 修改为中文
Vue.use(Element, { locale })
2、在nuxt.config.js的plugins中引入该js文件:
3、大功告成
最后发现表格和分页都正常切换成中文版本了。