1、npm install element-plus --save,安装UI
2、main.js代码如下:
// import './assets/main.css' // 引入下面这两行 import ElementPlus from 'element-plus' import 'element-plus/dist/index.css' import {createApp} from 'vue' import App from './App.vue' import Config from "@/config.js"; const app = createApp(App); // 引入下面这一行 app.use(ElementPlus, {size: 'small', zIndex: 3000}) app.provide('Config', Config) app.mount('#app')
3、App.vue代码如下:
<template> <div class="mb-4"> <el-button>Default</el-button> <el-button type="primary">Primary</el-button> <el-button type="success">Success</el-button> <el-button type="info">Info</el-button> <el-button type="warning">Warning</el-button> <el-button type="danger">Danger</el-button> </div> <div> <el-button :icon="Search" circle /> <el-button type="primary" :icon="Edit" circle /> <el-button type="success" :icon="Check" circle /> <el-button type="info" :icon="Message" circle /> <el-button type="warning" :icon="Star" circle /> <el-button type="danger" :icon="Delete" circle /> </div> </template> <script lang="ts" setup> import { Check, Delete, Edit, Message, Search, Star, } from '@element-plus/icons-vue' </script>
标签:vue,ElementUI,app,element,plus,Vue3,import,040 From: https://www.cnblogs.com/tianpan2019/p/18359871