24 lines
799 B
JavaScript
24 lines
799 B
JavaScript
![]() |
"use strict";
|
||
|
Object.defineProperty(exports, "__esModule", { value: true });
|
||
|
var tslib_1 = require("tslib");
|
||
|
var props_1 = require("./props");
|
||
|
var fmtEvent_1 = tslib_1.__importDefault(require("../_util/fmtEvent"));
|
||
|
var value_1 = tslib_1.__importDefault(require("../mixins/value"));
|
||
|
Component({
|
||
|
props: props_1.SwitchDefaultProps,
|
||
|
mixins: [(0, value_1.default)({
|
||
|
valueKey: 'checked',
|
||
|
defaultValueKey: 'defaultChecked',
|
||
|
})],
|
||
|
methods: {
|
||
|
onChange: function (e) {
|
||
|
var value = !this.getValue();
|
||
|
if (!this.isControlled()) {
|
||
|
this.update(value);
|
||
|
}
|
||
|
if (this.props.onChange) {
|
||
|
this.props.onChange(value, (0, fmtEvent_1.default)(this.props, e));
|
||
|
}
|
||
|
}
|
||
|
},
|
||
|
});
|