antd-mini
Version:
antd-mini 是支付宝小程序 UI 组件库,遵循 Ant Design 规范。
31 lines (30 loc) • 797 B
JavaScript
import mixinValue from '../mixins/value';
import { Component, triggerEvent } from '../_util/simply';
import { isAilpayNative } from '../_util/support';
import { CheckboxDefaultProps } from './props';
Component({
data: {
isLabelSupport: true,
},
props: CheckboxDefaultProps,
onInit: function () {
this.setData({
isLabelSupport: !isAilpayNative(),
});
},
methods: {
onChange: function (e) {
var value = !this.getValue();
if (!this.isControlled()) {
this.update(value);
}
triggerEvent(this, 'change', value, e);
},
},
mixins: [
mixinValue({
valueKey: 'checked',
defaultValueKey: 'defaultChecked',
}),
],
});