Element UI V1.2 是一个基于 Vue 2.0 的桌面端组件库。以下是一些常用组件的简单使用方法:
- 安装和引入 Element UI V1.2:
 
npm install element-ui@1.2.0 --save
在 Vue 项目中引入 Element UI:
import Vue from 'vue'
import ElementUI from 'element-ui'
import 'element-ui/lib/theme-default/index.css'
 
Vue.use(ElementUI)
- 使用 Button 组件:
 
<template>
  <el-button type="primary">点击我</el-button>
</template>
- 使用 Form 和 Input 组件:
 
<template>
  <el-form :model="form">
    <el-form-item label="用户名">
      <el-input v-model="form.username"></el-input>
    </el-form-item>
    <el-form-item>
      <el-button type="primary" @click="onSubmit">提交</el-button>
    </el-form-item>
  </el-form>
</template>
 
<script>
export default {
  data() {
    return {
      form: {
        username: ''
      }
    };
  },
  methods: {
    onSubmit() {
      console.log(this.form);
    }
  }
};
</script>
- 使用 Table 组件:
 
<template>
  <el-table :data="tableData">
    <el-table-column prop="date" label="日期" width="180"></el-table-column>
    <el-table-column prop="name" label="姓名" width="180"></el-table-column>
    <el-table-column prop="address" label="地址"></el-table-column>
  </el-table>
</template>
 
<script>
export default {
  data() {
    return {
      tableData: [{
        date: '2016-05-02',
        name: '王小虎',
        address: '上海市普陀区金沙江路 1518 弄'
      }, {
        date: '2016-05-04',
        name: '李小虎',
        address: '上海市普陀区金沙江路 1517 弄'
      }]
    };
  }
};
</script>
- 使用 Dialog 组件:
 
<template>
  <el-button @click="dialogVisible = true">打开对话框</el-button>
  <el-dialog title="提示" :visible.sync="dialogVisible" width="30%">
    <span>这是一段信息</span>
    <span slot="footer" class="dialog-footer">
      <el-button @click="dialogVisible = false">取 消</el-button>
      <el-button type="primary" @click="dialogVisible = false">确 定</el-button>
    </span>
  </el-dialog>
</template>
 
<script>
export default {
  data() {
    return {
      dialogVisible: false
    };
  }
};
</script>
以上代码提供了 Element UI V1.2 的一些常用组件的简单使用示例。Element UI V1.2 支持 Vue 2.0,并且提供了丰富的组件库,适用于桌面端的 Web 应用开发。