(vue)vue3使用element


element-ui支持vue2版本,当vue3项目安装element-ui的时候会报错,应安装element-plus版本。

element-ui网址:https://element.eleme.cn/#/zh-CN/

element-plus网址:https://element-plus.gitee.io/zh-CN/


1、首先安装element-plus

npm install element-plus --save

package.json文件中查看
在这里插入图片描述

2、修改main.js或main.ts文件

import { createApp } from "vue";
import App from "./App.vue";
import router from "./router";
import store from "./store";
import ElementPlus from 'element-plus';
import 'element-plus/theme-chalk/index.css';
import locale from 'element-plus/lib/locale/lang/zh-cn'

createApp(App).use(store).use(router).use(scroll).use(ElementPlus, { locale }).mount("#app");

3、代码中使用

在这里插入图片描述
效果:
在这里插入图片描述


解决参考:https://blog.csdn.net/qq_53966155/article/details/126144035

GitHub 加速计划 / eleme / element
10
1
下载
A Vue.js 2.0 UI Toolkit for Web
最近提交(Master分支:5 个月前 )
c345bb45 9 个月前
a07f3a59 * Update transition.md * Update table.md * Update transition.md * Update table.md * Update transition.md * Update table.md * Update table.md * Update transition.md * Update popover.md 9 个月前
Logo

旨在为数千万中国开发者提供一个无缝且高效的云端环境,以支持学习、使用和贡献开源项目。

更多推荐