main.js
复制代码
1
2
3
4
5
6
7
8
9
10
11
12import { 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
复制代码
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71<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内容请搜索靠谱客的其他文章。
本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
发表评论 取消回复