今日问题:Vue3 + Element Plus 国际化设置中文和使用图标无效解决方法

问题1: Vue3 + Element Plus 国际化设置中文无效,

错误代码如下:

import ElementPlus from 'element-plus'
import zhCn from 'element-plus/dist/locale/zh-cn.mjs'
import 'element-plus/dist/index.css'

createApp(App).use(ElementPlus).use(ElementPlus, {locale:zhCn}).mount('#app')

错误原因:使用了两次ElementPlus,去掉一个运行成功,正确如下:

import ElementPlus from 'element-plus'
import zhCn from 'element-plus/dist/locale/zh-cn.mjs'
import 'element-plus/dist/index.css'

createApp(App).use(ElementPlus, {locale:zhCn}).mount('#app')

问题2: 使用图标无效

错误代码如下:



错误原因:使用图标需要注册组件,正确代码如下:



你可能感兴趣的:(javascript,vue.js,开发语言)