mirror of
https://gitee.com/vant-contrib/vant-weapp.git
synced 2025-04-05 19:41:45 +08:00
45 lines
971 B
JavaScript
45 lines
971 B
JavaScript
import { VantComponent } from '../common/component';
|
|
import { button } from '../mixins/button';
|
|
|
|
VantComponent({
|
|
mixins: [button],
|
|
|
|
props: {
|
|
plain: Boolean,
|
|
block: Boolean,
|
|
square: Boolean,
|
|
loading: Boolean,
|
|
disabled: Boolean,
|
|
type: {
|
|
type: String,
|
|
value: 'default'
|
|
},
|
|
size: {
|
|
type: String,
|
|
value: 'normal'
|
|
}
|
|
},
|
|
|
|
computed: {
|
|
classes() {
|
|
const { type, size, plain, disabled, loading, square, block } = this.data;
|
|
return this.classNames(`van-button--${type}`, `van-button--${size}`, {
|
|
'van-button--block': block,
|
|
'van-button--plain': plain,
|
|
'van-button--square': square,
|
|
'van-button--loading': loading,
|
|
'van-button--disabled': disabled,
|
|
'van-button--unclickable': disabled || loading
|
|
});
|
|
}
|
|
},
|
|
|
|
methods: {
|
|
onClick() {
|
|
if (!this.data.disabled && !this.data.loading) {
|
|
this.$emit('click');
|
|
}
|
|
}
|
|
}
|
|
});
|