安装如下依赖(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

相关推荐
崔庆才丨静觅8 小时前
hCaptcha 验证码图像识别 API 对接教程
前端
passerby60619 小时前
完成前端时间处理的另一块版图
前端·github·web components
掘了9 小时前
「2025 年终总结」在所有失去的人中,我最怀念我自己
前端·后端·年终总结
崔庆才丨静觅9 小时前
实用免费的 Short URL 短链接 API 对接说明
前端
崔庆才丨静觅9 小时前
5分钟快速搭建 AI 平台并用它赚钱!
前端
崔庆才丨静觅10 小时前
比官方便宜一半以上!Midjourney API 申请及使用
前端
Moment10 小时前
富文本编辑器在 AI 时代为什么这么受欢迎
前端·javascript·后端
崔庆才丨静觅10 小时前
刷屏全网的“nano-banana”API接入指南!0.1元/张量产高清创意图,开发者必藏
前端
剪刀石头布啊10 小时前
jwt介绍
前端
爱敲代码的小鱼10 小时前
AJAX(异步交互的技术来实现从服务端中获取数据):
前端·javascript·ajax