72 lines
2.5 KiB
JavaScript
72 lines
2.5 KiB
JavaScript
"use strict";
|
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
var tslib_1 = require("tslib");
|
|
var props_1 = require("./props");
|
|
var value_1 = tslib_1.__importDefault(require("../mixins/value"));
|
|
Component({
|
|
mixins: [
|
|
(0, value_1.default)({
|
|
valueKey: 'current',
|
|
defaultValueKey: 'defaultCurrent',
|
|
}),
|
|
],
|
|
props: props_1.GuideTourDefaultProps,
|
|
methods: {
|
|
onNext: function () {
|
|
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
|
var currentValue, onChange, newCurrent;
|
|
return tslib_1.__generator(this, function (_a) {
|
|
currentValue = this.getValue();
|
|
onChange = this.props.onChange;
|
|
newCurrent = currentValue + 1;
|
|
if (!this.isControlled()) {
|
|
this.update(newCurrent);
|
|
}
|
|
if (onChange) {
|
|
onChange(newCurrent);
|
|
}
|
|
return [2 /*return*/];
|
|
});
|
|
});
|
|
},
|
|
onPrev: function () {
|
|
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
|
var currentValue, onChange, newCurrent;
|
|
return tslib_1.__generator(this, function (_a) {
|
|
currentValue = this.getValue();
|
|
onChange = this.props.onChange;
|
|
newCurrent = currentValue - 1;
|
|
if (!this.isControlled()) {
|
|
this.update(newCurrent);
|
|
}
|
|
if (onChange) {
|
|
onChange(newCurrent);
|
|
}
|
|
return [2 /*return*/];
|
|
});
|
|
});
|
|
},
|
|
onCancel: function () {
|
|
var onCancel = this.props.onCancel;
|
|
if (onCancel) {
|
|
onCancel();
|
|
}
|
|
},
|
|
onSwiperChange: function (e) {
|
|
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
|
var current, onChange;
|
|
return tslib_1.__generator(this, function (_a) {
|
|
current = e.detail.current;
|
|
onChange = this.props.onChange;
|
|
if (!this.isControlled()) {
|
|
this.update(current);
|
|
}
|
|
if (onChange) {
|
|
onChange(current);
|
|
}
|
|
return [2 /*return*/];
|
|
});
|
|
});
|
|
},
|
|
},
|
|
}); |