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

相关推荐
A923A11 分钟前
【从零开始学 React | 第四章】useEffect和自定义Hook
前端·react.js·fetch·useeffect
ZC跨境爬虫15 分钟前
批量爬取小说章节并优化排版(附完整可运行脚本)
前端·爬虫·python·自动化
ZC跨境爬虫18 分钟前
海南大学交友平台登录页开发实战day4(解决python传输并读取登录信息的问题)
开发语言·前端·python·flask·html
来一颗砂糖橘21 分钟前
pnpm:现代前端开发的高效包管理器
前端·pnpm
前端摸鱼匠21 分钟前
Vue 3 的defineProps编译器宏:详解<script setup>中defineProps的使用
前端·javascript·vue.js·前端框架·ecmascript
木斯佳22 分钟前
前端八股文面经大全: 美团财务科技前端一面 (2026-04-09)·面经深度解析
前端·实习面经·前端初级
天外天-亮23 分钟前
Vue2.0 + jsmind:开发思维导图
javascript·vue.js·jsmind
LIO25 分钟前
React 零基础入门,一篇搞懂核心用法(适合新手)
前端·react.js
TeamDev40 分钟前
JxBrowser 8.18.2 版本发布啦!
java·前端·跨平台·桌面应用·web ui·jxbrowser·浏览器控件
netkiller-BG7NYT40 分钟前
yoloutils - Openclaw Agent Skill
前端·webpack·node.js