博主
258
258
258
258
专辑

第二节 Vue3集成Element Plus

亮子 2024-01-14 11:47:58 7702 0 0 0

1、安装依赖

# NPM
$ npm install element-plus --save

图片alt

图片alt

2、修改main.js文件

import './assets/main.css'

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

const app = createApp(App)

app.use(router)
app.use(ElementPlus)

app.mount('#app')

图片alt

3、测试ElementPlus

<template>
    <div>
        <el-row 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>
        </el-row>
    </div>
</template>

<script setup>

</script>

<style lang="scss" scoped>

</style>

图片alt