index.js
1.4 KB
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
import { VantComponent } from '../common/component';
import { button } from '../mixins/button';
import { openType } from '../mixins/open-type';
VantComponent({
classes: ['loading-class'],
mixins: [button, openType],
props: {
plain: Boolean,
block: Boolean,
round: Boolean,
square: Boolean,
loading: Boolean,
disabled: Boolean,
type: {
type: String,
value: 'default'
},
size: {
type: String,
value: 'normal'
}
},
computed: {
classes: function classes() {
var _this$data = this.data,
type = _this$data.type,
size = _this$data.size,
block = _this$data.block,
plain = _this$data.plain,
round = _this$data.round,
square = _this$data.square,
loading = _this$data.loading,
disabled = _this$data.disabled;
return this.classNames("van-button--" + type, "van-button--" + size, {
'van-button--block': block,
'van-button--round': round,
'van-button--plain': plain,
'van-button--square': square,
'van-button--loading': loading,
'van-button--disabled': disabled,
'van-button--unclickable': disabled || loading
});
}
},
methods: {
onClick: function onClick() {
if (!this.data.disabled && !this.data.loading) {
this.$emit('click');
}
}
}
});