提交 | 用户 | age
|
d98d05
|
1 |
import { VantComponent } from '../common/component'; |
S |
2 |
import { button } from '../mixins/button'; |
|
3 |
import { openType } from '../mixins/open-type'; |
53cc6f
|
4 |
import { canIUseFormFieldButton } from '../common/version'; |
S |
5 |
const mixins = [button, openType]; |
|
6 |
if (canIUseFormFieldButton()) { |
|
7 |
mixins.push('wx://form-field-button'); |
|
8 |
} |
d98d05
|
9 |
VantComponent({ |
53cc6f
|
10 |
mixins, |
d98d05
|
11 |
classes: ['hover-class', 'loading-class'], |
S |
12 |
data: { |
|
13 |
baseStyle: '', |
|
14 |
}, |
|
15 |
props: { |
53cc6f
|
16 |
formType: String, |
d98d05
|
17 |
icon: String, |
S |
18 |
classPrefix: { |
|
19 |
type: String, |
|
20 |
value: 'van-icon', |
|
21 |
}, |
|
22 |
plain: Boolean, |
|
23 |
block: Boolean, |
|
24 |
round: Boolean, |
|
25 |
square: Boolean, |
|
26 |
loading: Boolean, |
|
27 |
hairline: Boolean, |
|
28 |
disabled: Boolean, |
|
29 |
loadingText: String, |
|
30 |
customStyle: String, |
|
31 |
loadingType: { |
|
32 |
type: String, |
|
33 |
value: 'circular', |
|
34 |
}, |
|
35 |
type: { |
|
36 |
type: String, |
|
37 |
value: 'default', |
|
38 |
}, |
|
39 |
dataset: null, |
|
40 |
size: { |
|
41 |
type: String, |
|
42 |
value: 'normal', |
|
43 |
}, |
|
44 |
loadingSize: { |
|
45 |
type: String, |
|
46 |
value: '20px', |
|
47 |
}, |
53cc6f
|
48 |
color: String, |
d98d05
|
49 |
}, |
S |
50 |
methods: { |
|
51 |
onClick() { |
|
52 |
if (!this.data.loading) { |
|
53 |
this.$emit('click'); |
|
54 |
} |
|
55 |
}, |
|
56 |
noop() {}, |
|
57 |
}, |
|
58 |
}); |