概述
main.js
import { createApp } from 'vue'
import ElementPlus from 'element-plus'
import 'element-plus/dist/index.css'
import App from './App.vue'
// createApp(App).mount('#app')
const app = createApp(App)
app.use(ElementPlus)
app.mount('#app')
Helloworld.vue
<template>
<div class="hello">
<h1>{{ msg }}</h1>
<div style="width:200px; margin:auto auto;"><el-empty description="空空如也~~~"></el-empty></div>
<p>欢迎来到德莱联盟</p>
<el-row class="mb-4">
<el-button type="success" loading :loading-icon="Eleme">Default-success-loading</el-button>
<el-button type="danger" loading>Default-danger-loading</el-button>
</el-row>
<el-row class="mb-4">
<el-button type="primary">Default-primary-upload<el-icon class="el-icon--right"><Upload /></el-icon></el-button>
</el-row>
<el-row class="mb-4">
<el-button type="primary" :icon="Edit" />
<el-button type="primary" :icon="Share" />
<el-button type="primary" :icon="Delete" />
<el-button type="primary" :icon="Search">Search</el-button>
<el-button type="primary">
Upload<el-icon class="el-icon--right"><Upload /></el-icon>
</el-button>
</el-row>
</div>
</template>
<script>
import { Delete, Edit, Search, Share, Eleme, Upload } from '@element-plus/icons-vue'
export default {
name: 'HelloWorld',
props: {
msg: String
},
data(){
return {
// Eleme: 'Eleme'
}
},
setup(){
return {
Delete, Edit, Search, Share, Eleme
}
},
// 如果是vue3非setup情况,还需要注册
components: {
Upload
}
}
</script>
<!-- Add "scoped" attribute to limit CSS to this component only -->
<style scoped>
h3 {
margin: 40px 0 0;
}
ul {
list-style-type: none;
padding: 0;
}
li {
display: inline-block;
margin: 0 10px;
}
a {
color: #42b983;
}
</style>
最后
以上就是激昂鸭子为你收集整理的Vue3通过js使用Element-plus使用icon的全部内容,希望文章能够帮你解决Vue3通过js使用Element-plus使用icon所遇到的程序开发问题。
如果觉得靠谱客网站的内容还不错,欢迎将靠谱客网站推荐给程序员好友。
本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
发表评论 取消回复