30 lines
930 B
JavaScript
30 lines
930 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.TabBarDefaultProps,
|
|
mixins: [
|
|
(0, value_1.default)({
|
|
valueKey: 'current',
|
|
defaultValueKey: 'defaultCurrent',
|
|
}),
|
|
],
|
|
methods: {
|
|
onChange: function (e) {
|
|
var index = e.target.dataset.index;
|
|
var onChange = this.props.onChange;
|
|
if (index === this.getValue()) {
|
|
return;
|
|
}
|
|
if (!this.isControlled()) {
|
|
this.update(index);
|
|
}
|
|
if (onChange) {
|
|
onChange(index, (0, fmtEvent_1.default)(this.props, e));
|
|
}
|
|
},
|
|
},
|
|
}); |