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

相关推荐
Csvn7 小时前
WASM
前端
修己xj9 小时前
我用 AI 给自己写了一个 Markdown 编辑器,然后把它开源了
前端
FRing039 小时前
vue2干货总结2(v-bind、v-for、v-model、指令修饰符、v-bind操作class和style)
开发语言·前端·vue.js·vue2
幸运小猿9 小时前
模拟慢上传-处理超时重试image 丢失线上问题
前端·javascript·html
moshuying11 小时前
网购能买Token了!
前端
h_654321011 小时前
echarts实现柱状图加一条横线
前端·echarts
风骏时光牛马11 小时前
生成一个后端标题,只需要一个标题,不需要其他的任何文本。
前端
子非鱼@Itfuture11 小时前
关于前后端联调中登录状态/登录信息失效?
java·前端
郭小李11 小时前
openFeign入门
java·开发语言·前端
馒头不想说话11 小时前
AI当运营,帮你省人力
前端