File tree 2 files changed +64
-7
lines changed
2 files changed +64
-7
lines changed Original file line number Diff line number Diff line change 1
1
<template >
2
2
<div >
3
- <h1 >Button 示例</h1 >
3
+ <h1 >Button 示例 1 </h1 >
4
4
<div >
5
5
<Button @click =" onClick" >你好</Button >
6
6
<Button @click =" onClick" theme =" button" >你好</Button >
7
7
<Button @click =" onClick" theme =" text" >你好</Button >
8
8
<Button @click =" onClick" theme =" link" >你好</Button >
9
9
</div >
10
+ <h1 >Button 示例 2</h1 >
11
+ <div >
12
+ <Button >你好</Button >
13
+ <Button size =" big" >你好</Button >
14
+ <Button size =" small" >你好</Button >
15
+ <Button size =" mini" >你好</Button >
16
+ </div >
10
17
</div >
11
18
</template >
12
19
<script lang="ts">
Original file line number Diff line number Diff line change 1
1
<template >
2
- <button class =" zhiwei-button" :class =" `zhiwei-theme-${theme}` " >
2
+ <button class =" zhiwei-button" :class =" classes " >
3
3
<slot ></slot >
4
4
</button >
5
5
</template >
6
6
7
7
<script lang="ts">
8
+ import { computed } from ' vue'
8
9
export default {
9
- props:{
10
- theme:{
11
- type:String ,
12
- default: ' button'
10
+ props:{
11
+ theme:{
12
+ type:String ,
13
+ default: ' button'
14
+ },
15
+ size:{
16
+ type: String ,
17
+ default: ' normal'
18
+ }
19
+ },
20
+ setup(props ){
21
+ const { theme,size } = props
22
+ const classes = computed (()=> {
23
+ return {
24
+ [` zhiwei-theme-${theme } ` ]:theme ,
25
+ [` zhiwei-size-${size } ` ]:size
26
+ }
27
+ })
28
+ return {
29
+ classes
30
+ }
13
31
}
14
- }
15
32
};
16
33
</script >
17
34
@@ -49,5 +66,38 @@ $radius: 4px;
49
66
& ::-moz-focus-inner {
50
67
border : 0 ;
51
68
}
69
+ & .zhiwei-theme-link {
70
+ border-color : transparent ;
71
+ box-shadow : none ;
72
+ color : $blue ;
73
+ & :hover ,
74
+ & :focus {
75
+ color : lighten ($blue , 10% );
76
+ }
77
+ }
78
+ & .zhiwei-theme-text {
79
+ border-color : transparent ;
80
+ box-shadow : none ;
81
+ color : inherit ;
82
+ & :hover ,
83
+ & :focus {
84
+ background : darken (white , 5% );
85
+ }
86
+ }
87
+ & .zhiwei-size-big {
88
+ font-size : 24px ;
89
+ height : 48px ;
90
+ padding : 0 16px ;
91
+ }
92
+ & .zhiwei-size-small {
93
+ font-size : 12px ;
94
+ height : 20px ;
95
+ padding : 0 4px ;
96
+ }
97
+ & .zhiwei-size-mini {
98
+ font-size : 10px ;
99
+ height : 16px ;
100
+ padding : 0 2px ;
101
+ }
52
102
}
53
103
</style >
You can’t perform that action at this time.
0 commit comments