Vue Element 安装与使用

Vue Element 安装与使用

Vue Element 就是 Vue 的扩展插件。官方文档:https://element.eleme.cn/#/zh-CN

建议:按照官网中的文档进行学习,写项目时复制官网代码进行修改。

1. 添加依赖

在 vue3.0 中使用 element 框架,因为 element-ui 是支持 vue2.0 的,他推出的支持 vue3.0的版本叫 element-plus。安装 element-plus,直接在 IDEA 中 Terminal 中运行:

cnpm install element-plus --save

使用安装指令 cnpm install --save element-ui 已经不适用于 vue-cli3 之前的版本,在正式安装 Element 依赖之前一定要把版本看清楚,否则会出现如下不兼容的情况。

2. 引入 Element 依赖

修改 main.js

3. 添加标签

在 App.vue 中添加 Element 官网中组件内容。以按钮举例:

<template>
    <div id="app">
        <el-button type="primary">搜索</el-button>
    </div>
    <router-view/>
</template>

4、查看页面

在页面中会显示带有样式的按钮


关于 Element-UI 相关的组件参考 3.x 版本的文档。

猜你喜欢

转载自blog.csdn.net/qq_41775769/article/details/123474463
今日推荐