下面为案例:
1、自定义一个按钮组件
01 | < template > |
02 | < button class = "btn-primary" > |
03 | < slot ></ slot > |
04 | </ button > |
05 | </ template > |
06 | < script > |
07 | export default { |
08 | } |
09 | </ script > |
10 | < style lang = "scss" > |
11 | .btn-primary { |
12 | padding: 5px 10px; |
13 | background: orange; |
14 | color: #fff; |
15 | border: none; |
16 | } |
17 | </ style > |
1 | < v-button class = "btn-primary" >登录</ v-button > |
1 | < v-button class = "btn-primary" > |
2 | < i >Icon</ i > 登录 |
3 | </ v-button > |
1 | < v-button class = "btn-primary" > |
2 | < i >Icon</ i > 登录 |
3 | {{title}} |
4 | </ v-button > |