安装如下依赖(package.json 未包含):vueelement-plusecharts@element-plus/icons-vue

安装如下依赖(package.json 未包含):

vue

element-plus

echarts

@element-plus/icons-vue


安装指定的依赖(Vue、Element Plus、ECharts 和 Element Plus 图标)

1. 安装 Vue(Vue 3)

复制代码
npm install vue@next

2. 安装 Element Plus 及其图标库

复制代码
npm install element-plus @element-plus/icons-vue

3. 安装 ECharts

复制代码
npm install echarts

完整安装命令(一次性安装所有依赖)

复制代码
npm install vue@next element-plus @element-plus/icons-vue echarts

说明:

  1. Vue 版本 :
    vue@next 会安装 Vue 3(当前最新稳定版),这是 Element Plus 的运行基础。

  2. 自动保存依赖 :

    以上命令会将依赖自动写入 package.json(如果文件不存在,首次安装时会自动创建)。

  3. 项目集成示例:

    复制代码
    // main.js
    import { createApp } from 'vue'
    import App from './App.vue'
    import ElementPlus from 'element-plus'
    import 'element-plus/dist/index.css'
    import * as Icons from '@element-plus/icons-vue'
    
    const app = createApp(App)
    
    // 注册所有图标
    for (const [name, component] of Object.entries(Icons)) {
      app.component(name, component)
    }
    
    app.use(ElementPlus)
    app.mount('#app')
  4. 验证安装 :

    检查 package.json 中的 dependencies 是否包含:

    复制代码
    "dependencies": {
      "@element-plus/icons-vue": "^2.x",
      "element-plus": "^2.x",
      "echarts": "^5.x",
      "vue": "^3.x"
    }

注意:实际版本号(x部分)将以安装时的最新稳定版为准。如需指定版本,可在包名后添加 @版本号,例如 element-plus@2.0.1。

相关推荐
踩蚂蚁4 分钟前
从“打开灯光”看 KWS 多关键词语音控制是怎么工作的
前端
ppiero15 分钟前
AI 助手聊着聊着就失忆?先分清"上下文"和"记忆"(五步装长期记忆)
前端
打呵欠的猫20 分钟前
用 AI 做性能分析:一行命令找出拖慢页面的 5 个组件,优化后首屏快了 40%
前端·性能优化·ai编程
用户50800705462822 分钟前
芯飞云用了两个月,说说我的真实感受
前端
Amos_Web22 分钟前
Rspack 源码解析(二十一):Cacheable 与 Storage 如何持久化编译结果
前端·rust·前端框架
青烟小生27 分钟前
前端性能优化实战:从指标监控到极致体验
前端
deli00729 分钟前
0.1 加 0.2 为什么不等于 0.3?IEEE 754 双精度逐位实测
前端
Momo__30 分钟前
前端 Code Review 实战:识别 AI 写代码的 15 个常见坑
前端·vibecoding
拖孩34 分钟前
全程 AI 写的小程序,刚接上会员虚拟支付,上线第二天就有人真金白银买单了|双签名、定价、iOS 的坑我全踩了一遍
前端·后端·微信小程序
小蚂蚁i35 分钟前
React 基础
前端