element-plus
安裝
npm install element-plus --save
在main.js引用
import {createApp} from 'vue'
import router from './router/index'
import store from './store/index'
import i18n from './locales/index'
import ElementPlus from 'element-plus' //引入插件
import 'element-plus/theme-chalk/index.css' //默認css樣式
import zhCn from 'element-plus/es/locale/lang/zh-cn' //引入中文包
import App from './App.vue'
createApp(App)
.use(store)
.use(router)
.use(i18n)
.use(ElementPlus,{locale:zhCn}) // use
.mount('#app')
使用控件
修改App.vue
<template> <img alt="Vue logo" src="./assets/logo.png" /> <el-form :inline="true" :model="formInline" class="demo-form-inline"> <el-form-item label="審批人"> <el-input v-model="formInline.user" placeholder="審批人"></el-input> </el-form-item> <el-form-item label="活動區域"> <el-select v-model="formInline.region" placeholder="活動區域"> <el-option label="區域一" value="shanghai"></el-option> <el-option label="區域二" value="beijing"></el-option> </el-select> </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 { formInline: { user: "", region: "", }, }; }, methods: { onSubmit() { console.log("submit!"); }, }, }; </script>

