jiaqingjiayi-xiaochengxu/甲情_甲意/miniprogram/node_modules/antd-mini/less/GuideTour/index.js
2024-12-01 19:56:54 +08:00

56 lines
1.9 KiB
JavaScript

import { __awaiter, __generator } from "tslib";
import { Component, triggerEvent, triggerEventOnly } from '../_util/simply';
import { GuideTourDefaultProps } from './props';
import mixinValue from '../mixins/value';
Component(GuideTourDefaultProps, {
onNext: function () {
return __awaiter(this, void 0, void 0, function () {
var currentValue, newCurrent;
return __generator(this, function (_a) {
currentValue = this.getValue();
newCurrent = currentValue + 1;
if (!this.isControlled()) {
this.update(newCurrent);
}
triggerEvent(this, 'change', newCurrent);
return [2 /*return*/];
});
});
},
onPrev: function () {
return __awaiter(this, void 0, void 0, function () {
var currentValue, newCurrent;
return __generator(this, function (_a) {
currentValue = this.getValue();
newCurrent = currentValue - 1;
if (!this.isControlled()) {
this.update(newCurrent);
}
triggerEvent(this, 'change', newCurrent);
return [2 /*return*/];
});
});
},
onCancel: function () {
triggerEventOnly(this, 'cancel');
},
onSwiperChange: function (e) {
return __awaiter(this, void 0, void 0, function () {
var current;
return __generator(this, function (_a) {
current = e.detail.current;
if (!this.isControlled()) {
this.update(current);
}
triggerEvent(this, 'change', current);
return [2 /*return*/];
});
});
},
}, undefined, [
mixinValue({
valueKey: 'current',
defaultValueKey: 'defaultCurrent',
}),
]);