Explain how Vue3 uses element plus in detail

  • 2021-12-05 05:18:35
  • OfStack

Directory 1, Installation 2, Introduction 3 in main. js, Use

vue3 has been out for a period of time, and element has been updated to be compatible with vue3. Here, how to use element-plus is briefly introduced

1. Installation


npm install element-plus --save

2. Introduced in main. js


import { createApp, Vue } from 'vue';
import ElementPlus from 'element-plus';
import 'element-plus/dist/index.css';
import App from './App.vue';

const app = createApp(App)
app.use(ElementPlus)
app.mount('#app')

3. Use

The button is used here


<el-row>
  <el-button> Default button </el-button>
  <el-button type="primary"> Main button </el-button>
  <el-button type="success"> Success button </el-button>
  <el-button type="info"> Information button </el-button>
  <el-button type="warning"> Warning button </el-button>
  <el-button type="danger"> Danger button </el-button>
</el-row>

You can check the official documents for details


Related articles: