当前位置: 首页 > article >正文

vue3 使用 elementUi: ./lib/theme-chalk/index.css is not exported from package

目录

  • 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 了。


http://www.kler.cn/a/104845.html

相关文章:

  • idea + Docker-Compose 实现自动化打包部署(仅限测试环境)
  • 设计模式(12)状态模式
  • centos7配置
  • Python在不同场景下的并发编程方案选择
  • Elasticsearch中使用join来进行父子关联
  • 进程等待..
  • 适用于 Windows 10 和 Windows 11 设备的笔记本电脑管理软件
  • 10-动画animation
  • go多线程示例
  • 【2021集创赛】Arm杯三等奖:基于FPGA的人脸检测SoC设计
  • 找免费商用字体,就上这5个网站,再也不怕侵权了。
  • 深入浅出排序算法之希尔排序
  • RabbitMQ高级篇 笔记
  • 说说对ajax、axios、jsonp的理解
  • 腾讯云国际-如何使用对象存储COS在 CKafka 控制台创建数据异步拉取任务?腾讯云代充
  • filebeat7.10上传日志到ES7.14
  • 华为数通方向HCIP-DataCom H12-831题库(多选题:61-80)
  • vscode不显示横滚动条处理
  • 杀毒软件的原理
  • 【Lua语法】字符串