search
HomeWeb Front-endVue.jsA detailed introduction to the ElementUI component library

This article brings you relevant knowledge about vue, which mainly introduces related issues about the ElementUI component library. The ElementUI component library is a set of desktop component libraries based on vue2.0 , provides a wealth of components to help developers quickly build pages. Let’s take a look at them. I hope it will be helpful to everyone.

A detailed introduction to the ElementUI component library

【Related recommendations: javascript video tutorial, vue.js tutorial

ElementUI introduction

ElementUI is a set of desktop component libraries based on VUE2.0. ElementUI provides a rich set of components to help developers quickly build pages with powerful functions and unified styles.

Official website address: http://element-cn.eleme.io/#/zh-CN

Introduce js and css files on the page to start using it, as follows:

<!-- 引入ElementUI样式 -->
<link>
<script></script>
<!-- 引入ElementUI组件库 -->
<script></script>

Container Layout Container

Container component used for layout, convenient for quickly building the basic structure of the page:

<el-container></el-container>: outer container . When the child elements contain <el-header></el-header> or <el-footer></el-footer>, all child elements will be arranged vertically up and down, otherwise they will be arranged horizontally left and right

<el-header></el-header>:Top bar container

<el-aside></el-aside>:Side bar container

&lt ;el-main>:Main area container

<el-footer></el-footer>:Bottom column container

  <div>
    <el-container>
      <el-header>Header</el-header>
      <el-container>
        <el-aside>Aside</el-aside>
        <el-container>
          <el-main>Main</el-main>
          <el-footer>Footer</el-footer>
        </el-container>
      </el-container>
    </el-container>
  </div>
  <style>
    .el-header, .el-footer {
      background-color: #B3C0D1;
      color: #333;
      text-align: left;
      line-height: 60px;
    }

    .el-aside {
      background-color: #D3DCE6;
      color: #333;
      text-align: center;
      line-height: 200px;
    }

    .el-main {
      background-color: #E9EEF3;
      color: #333;
      text-align: center;
      line-height: 590px;
    }
  </style>

<script>
  new Vue({
    el:&#39;#app&#39;
  });
</script>

Dropdown drop-down menu

Collapse an action or menu into a drop-down menu.

<el-dropdown>
  个人中心
  <el-dropdown-menu>
    <el-dropdown-item>退出系统</el-dropdown-item>
    <el-dropdown-item>修改密码</el-dropdown-item>
    <el-dropdown-item>联系管理员</el-dropdown-item>
  </el-dropdown-menu>
</el-dropdown>

NavMenu Navigation Menu

A menu that provides navigation functions for the website.

<el-menu>
  <el-submenu>
    <template>
      <i></i>
      <span>导航一</span>
    </template>
    <el-menu-item>选项1</el-menu-item>
    <el-menu-item>选项2</el-menu-item>
    <el-menu-item>选项3</el-menu-item>
  </el-submenu>
  <el-submenu>
    <template>
      <i></i>
      <span>导航二</span>
    </template>
    <el-menu-item>选项1</el-menu-item>
    <el-menu-item>选项2</el-menu-item>
    <el-menu-item>选项3</el-menu-item>
  </el-submenu>
</el-menu>

Table Table

is used to display multiple pieces of data with similar structure. The data can be sorted, filtered, compared or other customized operations.

<el-table>
  <el-table-column></el-table-column>
  <el-table-column></el-table-column>
  <el-table-column></el-table-column>
  <el-table-column>
    <!--
		slot-scope:作用域插槽,可以获取表格数据
    	scope:代表表格数据,可以通过scope.row来获取表格当前行数据,scope不是固定写法
    -->
    <template>
      <el-button>编辑</el-button>
      <el-button>删除</el-button>
    </template>
  </el-table-column>
</el-table>
<script>
  new Vue({
    el:&#39;#app&#39;,
    data:{
      tableData: [{
        date: &#39;2016-05-02&#39;,
        name: &#39;王小虎&#39;,
        address: &#39;上海市普陀区金沙江路 1518 弄&#39;
      }, {
        date: &#39;2016-05-04&#39;,
        name: &#39;王小虎&#39;,
        address: &#39;上海市普陀区金沙江路 1517 弄&#39;
      }, {
        date: &#39;2016-05-01&#39;,
        name: &#39;王小虎&#39;,
        address: &#39;上海市普陀区金沙江路 1519 弄&#39;
      }]
    },
    methods:{
      handleUpdate(row){
        alert(row.date);
      },
      handleDelete(row){
        alert(row.date);
      }
    }
  });
</script>

Pagination Pagination

When the amount of data is too large, use paging to break down the data.

<!--
	current-change:内置的事件,当前页码改变时会触发,可以获取到改变之后的页码
-->
<el-pagination>
</el-pagination>
<script>
  new Vue({
    el:&#39;#app&#39;,
    methods:{
      handleCurrentChange(page){
        alert(page);
      }
    }
  });
</script>

Message message prompt

is often used as a feedback prompt after active operations.

<el-button>消息</el-button>
<el-button>成功</el-button>
<el-button>警告</el-button>
<el-button>错误</el-button>
<script>
  new Vue({
    el: &#39;#app&#39;,
    methods: {
      open1() {
        this.$message(&#39;这是一条消息提示&#39;);
      },
      open2() {
        this.$message({
          message: &#39;恭喜你,这是一条成功消息&#39;,
          type: &#39;success&#39;
        });
      },
      open3() {
        this.$message({
          message: &#39;警告哦,这是一条警告消息&#39;,
          type: &#39;warning&#39;
        });
      },
      open4() {
        this.$message.error(&#39;错了哦,这是一条错误消息&#39;);
      }
    }
  })
</script>

Tabs Tab page

Separate data collections that are related in content but belong to different categories.

<h3 id="基础的-简洁的标签页">基础的、简洁的标签页</h3>
<!--
	通过value属性来指定当前选中的标签页
-->
<el-tabs>
  <el-tab-pane>用户管理</el-tab-pane>
  <el-tab-pane>配置管理</el-tab-pane>
  <el-tab-pane>角色管理</el-tab-pane>
  <el-tab-pane>定时任务补偿</el-tab-pane>
</el-tabs>
<h3 id="选项卡样式的标签页">选项卡样式的标签页</h3>
<el-tabs>
  <el-tab-pane>用户管理</el-tab-pane>
  <el-tab-pane>配置管理</el-tab-pane>
  <el-tab-pane>角色管理</el-tab-pane>
  <el-tab-pane>定时任务补偿</el-tab-pane>
</el-tabs>
<h3 id="卡片化的标签页">卡片化的标签页</h3>
<el-tabs>
  <el-tab-pane>用户管理</el-tab-pane>
  <el-tab-pane>配置管理</el-tab-pane>
  <el-tab-pane>角色管理</el-tab-pane>
  <el-tab-pane>定时任务补偿</el-tab-pane>
</el-tabs>
<script>
  new Vue({
    el: &#39;#app&#39;
  })
</script>

Form Form

is composed of input boxes, selectors, radio buttons, multi-select boxes and other controls, and is used to collect, verify and submit data. In the Form component, each form field is composed of a Form-Item component. Various types of form controls can be placed in the form field, including Input, Select, Checkbox, Radio, Switch, DatePicker, and TimePicker.

<!--
	rules:表单验证规则
-->
<el-form>
  <!--
  	prop:表单域 model 字段,在使用 validate、resetFields 方法的情况下,该属性是必填的
  -->
  <el-form-item>
    <el-input></el-input>
  </el-form-item>
  <el-form-item>
    <el-select>
      <el-option></el-option>
      <el-option></el-option>
    </el-select>
  </el-form-item>
  <el-form-item>
    <el-col>
      <el-date-picker></el-date-picker>
    </el-col>
    <el-col>-</el-col>
    <el-col>
      <el-time-picker></el-time-picker>
    </el-col>
  </el-form-item>
  <el-form-item>
    <el-switch></el-switch>
  </el-form-item>
  <el-form-item>
    <el-checkbox-group>
      <el-checkbox></el-checkbox>
      <el-checkbox></el-checkbox>
      <el-checkbox></el-checkbox>
      <el-checkbox></el-checkbox>
    </el-checkbox-group>
  </el-form-item>
  <el-form-item>
    <el-radio-group>
      <el-radio></el-radio>
      <el-radio></el-radio>
    </el-radio-group>
  </el-form-item>
  <el-form-item>
    <el-input></el-input>
  </el-form-item>
  <el-form-item>
    <el-button>立即创建</el-button>
  </el-form-item>
</el-form>
<script>
  new Vue({
    el: &#39;#app&#39;,
    data:{
      form: {
        name: &#39;&#39;,
        region: &#39;&#39;,
        date1: &#39;&#39;,
        date2: &#39;&#39;,
        delivery: false,
        type: [],
        resource: &#39;&#39;,
        desc: &#39;&#39;
      },
      //定义校验规则
      rules: {
        name: [
          { required: true, message: &#39;请输入活动名称&#39;, trigger: &#39;blur&#39; },
          { min: 3, max: 5, message: &#39;长度在 3 到 5 个字符&#39;, trigger: &#39;blur&#39; }
        ],
        region: [
          { required: true, message: &#39;请选择活动区域&#39;, trigger: &#39;change&#39; }
        ]
      }
    },
    methods:{
      onSubmit() {
        console.log(this.form);
        //validate:对整个表单进行校验的方法,参数为一个回调函数。
        //该回调函数会在校验结束后被调用,并传入两个参数:是否校验成功和未通过校验的字段。
        this.$refs[&#39;form&#39;].validate((valid) => {
          if (valid) {
            alert(&#39;submit!&#39;);
          } else {
            console.log(&#39;error submit!!&#39;);
            return false;
          }
        });
      }
    }
  })
</script>

【Related recommendations: javascript video tutorial, vue.js tutorial

The above is the detailed content of A detailed introduction to the ElementUI component library. For more information, please follow other related articles on the PHP Chinese website!

Statement
This article is reproduced at:CSDN. If there is any infringement, please contact admin@php.cn delete
What Happens When the Vue.js Virtual DOM Detects a Change?What Happens When the Vue.js Virtual DOM Detects a Change?May 14, 2025 am 12:12 AM

WhentheVue.jsVirtualDOMdetectsachange,itupdatestheVirtualDOM,diffsit,andappliesminimalchangestotherealDOM.ThisprocessensureshighperformancebyavoidingunnecessaryDOMmanipulations.

How Accurate Is It to Think of Vue.js's Virtual DOM as a Mirror of the Real DOM?How Accurate Is It to Think of Vue.js's Virtual DOM as a Mirror of the Real DOM?May 13, 2025 pm 04:05 PM

Vue.js' VirtualDOM is both a mirror of the real DOM, and not exactly. 1. Create and update: Vue.js creates a VirtualDOM tree based on component definitions, and updates VirtualDOM first when the state changes. 2. Differences and patching: Comparison of old and new VirtualDOMs through diff operations, and apply only the minimum changes to the real DOM. 3. Efficiency: VirtualDOM allows batch updates, reduces direct DOM operations, and optimizes the rendering process. VirtualDOM is a strategic tool for Vue.js to optimize UI updates.

Vue.js vs. React: Scalability and MaintainabilityVue.js vs. React: Scalability and MaintainabilityMay 10, 2025 am 12:24 AM

Vue.js and React each have their own advantages in scalability and maintainability. 1) Vue.js is easy to use and is suitable for small projects. The Composition API improves the maintainability of large projects. 2) React is suitable for large and complex projects, with Hooks and virtual DOM improving performance and maintainability, but the learning curve is steeper.

The Future of Vue.js and React: Trends and PredictionsThe Future of Vue.js and React: Trends and PredictionsMay 09, 2025 am 12:12 AM

The future trends and forecasts of Vue.js and React are: 1) Vue.js will be widely used in enterprise-level applications and have made breakthroughs in server-side rendering and static site generation; 2) React will innovate in server components and data acquisition, and further optimize the concurrency model.

Netflix's Frontend: A Deep Dive into Its Technology StackNetflix's Frontend: A Deep Dive into Its Technology StackMay 08, 2025 am 12:11 AM

Netflix's front-end technology stack is mainly based on React and Redux. 1.React is used to build high-performance single-page applications, and improves code reusability and maintenance through component development. 2. Redux is used for state management to ensure that state changes are predictable and traceable. 3. The toolchain includes Webpack, Babel, Jest and Enzyme to ensure code quality and performance. 4. Performance optimization is achieved through code segmentation, lazy loading and server-side rendering to improve user experience.

Vue.js and the Frontend: Building Interactive User InterfacesVue.js and the Frontend: Building Interactive User InterfacesMay 06, 2025 am 12:02 AM

Vue.js is a progressive framework suitable for building highly interactive user interfaces. Its core functions include responsive systems, component development and routing management. 1) The responsive system realizes data monitoring through Object.defineProperty or Proxy, and automatically updates the interface. 2) Component development allows the interface to be split into reusable modules. 3) VueRouter supports single-page applications to improve user experience.

What are the disadvantages of VueJs?What are the disadvantages of VueJs?May 05, 2025 am 12:06 AM

The main disadvantages of Vue.js include: 1. The ecosystem is relatively new, and third-party libraries and tools are not as rich as other frameworks; 2. The learning curve becomes steep in complex functions; 3. Community support and resources are not as extensive as React and Angular; 4. Performance problems may be encountered in large applications; 5. Version upgrades and compatibility challenges are greater.

Netflix: Unveiling Its Frontend FrameworksNetflix: Unveiling Its Frontend FrameworksMay 04, 2025 am 12:16 AM

Netflix uses React as its front-end framework. 1.React's component development and virtual DOM mechanism improve performance and development efficiency. 2. Use Webpack and Babel to optimize code construction and deployment. 3. Use code segmentation, server-side rendering and caching strategies for performance optimization.

See all articles

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

SublimeText3 Linux new version

SublimeText3 Linux new version

SublimeText3 Linux latest version

SecLists

SecLists

SecLists is the ultimate security tester's companion. It is a collection of various types of lists that are frequently used during security assessments, all in one place. SecLists helps make security testing more efficient and productive by conveniently providing all the lists a security tester might need. List types include usernames, passwords, URLs, fuzzing payloads, sensitive data patterns, web shells, and more. The tester can simply pull this repository onto a new test machine and he will have access to every type of list he needs.

ZendStudio 13.5.1 Mac

ZendStudio 13.5.1 Mac

Powerful PHP integrated development environment

DVWA

DVWA

Damn Vulnerable Web App (DVWA) is a PHP/MySQL web application that is very vulnerable. Its main goals are to be an aid for security professionals to test their skills and tools in a legal environment, to help web developers better understand the process of securing web applications, and to help teachers/students teach/learn in a classroom environment Web application security. The goal of DVWA is to practice some of the most common web vulnerabilities through a simple and straightforward interface, with varying degrees of difficulty. Please note that this software

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor