vue3 使用 elementUi: ./lib/theme

编程入门 行业动态 更新时间:2024-10-22 11:28:42

vue3 使用 <a href=https://www.elefans.com/category/jswz/34/1765722.html style=elementUi: ./lib/theme"/>

vue3 使用 elementUi: ./lib/theme

目录

  • 1. 在 vue3 中使用 element-ui
  • 2. 如果启动报错:Module not found: Error: Package path ./lib/theme-chalk/index.css is not exported from package

1. 在 vue3 中使用 element-ui

在 vue3 中使用 element-ui,我们的流程一般是这样的:

  1. 安装Element-Plus

    npm i element-plus -S
    
  2. main.js 中全局引入 element-plus

    import { createApp } from 'vue'
    import ElementPlus from 'element-plus';
    import 'element-plus/dist/index.css';
    import App from './App.vue'createApp(App).use(ElementPlus).mount('#app')
    
  3. 在 HelloWorld.vue 中测试一下

    <template><div class="hello"><el-button type="primary">搜索</el-button></div>
    </template>
    
  4. npm run serve 跑一下服务

2. 如果启动报错:Module not found: Error: Package path ./lib/theme-chalk/index.css is not exported from package

那就说明,main.js 中 element-plus 的 index.css 路径给配错了,这时候只需要打开 /node_modules/element-plus 去找到 index.css ,然后更改 main.js 中的路径就 OK 了。

更多推荐

vue3 使用 elementUi: ./lib/theme

本文发布于:2023-12-05 06:01:23,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1663306.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:elementUi   theme   lib

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!