Element ui installation configuration and some simple use

Element ui installation and some simple use

Installation and configuration

First install element ui in the scaffolding project, the command is as follows:

Insert picture description here

The code in the official website of element ui is used in the scaffolding project as shown below:

Insert picture description here

Before the main.js file is configured with information about element ui, such an error will be reported in the browser when starting the scaffolding project.

Insert picture description here

The reason for the above error is because the relevant information in the element ui is not introduced in the main.js file as shown in the figure:

Insert picture description here

You can go to the official website of element ui to see the instructions for use of element ui. As long as you can do the above two steps, first install element ui and then introduce element ui information into main.js, then we can use element ui, the above error Will disappear naturally.

[External link image transfer failed. The source site may have an anti-hotlinking mechanism. It is recommended to save the image and upload it directly (img-vLxhLKV5-1608727661854)(C:\Users\86184\AppData\Roaming\Typora\typora-user-images\ image-20201223204300599.png)]

Use of icons in element ui

Insert picture description here
Insert picture description here

Form verification in element ui official website

If the verification fails, the following picture will appear:

Insert picture description here

The meaning of several attributes of the form source code:

Insert picture description here

The following are the data in data and the validation rules for these data:

Insert picture description here

Insert picture description here

Form reset

It means to restore the content of each input box in the form to the original content. You can first get the corresponding form through this.$refs[formName], and then call the resetFields() method of this form. The source code of the form is as follows:

Insert picture description here

The code of the reset method in the methods method is as follows:

Insert picture description here

Get the verification result when the form is submitted

Insert picture description here

Container layout container in element ui

The common layout is as follows:

Insert picture description here

Insert picture description here

The following figure is the code of various layouts:

Insert picture description here

Insert picture description here

Insert picture description here

The use of navigation menu in element ui

First look at the effect of the custom menu navigation bar in the sidebar menu navigation bar, as shown below:

Insert picture description here

Next, let's take a look at what the code of the menu navigation bar corresponding to this effect looks like, and several important label elements, as shown below:

Insert picture description here
Insert picture description here

Insert picture description here

Insert picture description here
Click different menu options in the navigation menu to display different content in the component. The implementation process is as follows:
Insert picture description here
This process requires nested routing as shown in the figure below:
Insert picture description here
Insert picture description here
Insert picture description here
Insert picture description here

Use of dialog boxes in element ui

The source code of the dialog box defined in element ui is as follows:

Insert picture description here

The effect diagram of the dialog box in element ui:

Insert picture description here

The dialog box and verification form are nested as shown below:

Insert picture description here

The source code is as follows:

Insert picture description here

In form validation, the data of the form is placed in an object, and the rules of form validation are also placed in an object. The two data are stored in the data data as shown below:

Insert picture description here

Guess you like

Origin blog.csdn.net/qq_45950109/article/details/111598885