Vue Element installation and use

Vue Element installation and use

Vue Element is an extension of Vue. Official document: https://element.eleme.cn/#/zh-CN

Suggestion: study according to the documents on the official website, copy the official website code to modify when writing the project.

1. Add dependencies

The element framework is used in vue3.0, because element-ui supports vue2.0, and the version he launched that supports vue3.0 is called element-plus. Install element-plus and run it directly in Terminal in IDEA:

cnpm install element-plus --save

Using the installation instructions cnpm install --save element-uiis no longer applicable to versions prior to vue-cli3. Be sure to check the version before formally installing Element dependencies, otherwise the following incompatibilities will occur.

2. Introduce Element dependencies

Modify main.js

3. Add tags

Add the content of the components in the Element official website to App.vue. Take button as an example:

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

4. View the page

Buttons with styles will be displayed on the page


For Element-UI related components, please refer to the 3.x version of the documentation.

Guess you like

Origin blog.csdn.net/qq_41775769/article/details/123474463