weapp版本升级到1.11.7
"version": "1.11.7"
This commit is contained in:
1 parent
a3c886146a
commit
66ba21dd7b
67 files changed
+566
-365
No files matched your search
@@ -24,7 +24,6 @@ function transition(showDefaultValue) {
|
||||
duration: {
|
||||
type: null,
|
||||
value: 300,
|
||||
observer: 'observeDuration',
|
||||
},
|
||||
name: {
|
||||
type: String,
|
||||
@@ -46,76 +45,85 @@ function transition(showDefaultValue) {
|
||||
if (value === old) {
|
||||
return;
|
||||
}
|
||||
value ? this.enter() : this.leave();
|
||||
value ? this.enureEnter() : this.enureLeave();
|
||||
},
|
||||
enter: function () {
|
||||
enureEnter: function () {
|
||||
var _this = this;
|
||||
if (this.enterFinishedPromise)
|
||||
if (this.enterPromise)
|
||||
return;
|
||||
this.enterFinishedPromise = new Promise(function (resolve) {
|
||||
var _a = _this.data, duration = _a.duration, name = _a.name;
|
||||
var classNames = getClassNames(name);
|
||||
var currentDuration = (0, validator_1.isObj)(duration) ? duration.enter : duration;
|
||||
if (_this.status === 'enter') {
|
||||
this.enterPromise = new Promise(function (resolve) { return _this.enter(resolve); });
|
||||
},
|
||||
enureLeave: function () {
|
||||
var _this = this;
|
||||
var enterPromise = this.enterPromise;
|
||||
if (!enterPromise)
|
||||
return;
|
||||
enterPromise
|
||||
.then(function () { return new Promise(function (resolve) { return _this.leave(resolve); }); })
|
||||
.then(function () {
|
||||
_this.enterPromise = null;
|
||||
});
|
||||
},
|
||||
enter: function (resolve) {
|
||||
var _this = this;
|
||||
var _a = this.data, duration = _a.duration, name = _a.name;
|
||||
var classNames = getClassNames(name);
|
||||
var currentDuration = (0, validator_1.isObj)(duration) ? duration.enter : duration;
|
||||
if (this.status === 'enter') {
|
||||
return;
|
||||
}
|
||||
this.status = 'enter';
|
||||
this.$emit('before-enter');
|
||||
(0, utils_1.requestAnimationFrame)(function () {
|
||||
if (_this.status !== 'enter') {
|
||||
return;
|
||||
}
|
||||
_this.status = 'enter';
|
||||
_this.$emit('before-enter');
|
||||
_this.$emit('enter');
|
||||
_this.setData({
|
||||
inited: true,
|
||||
display: true,
|
||||
classes: classNames.enter,
|
||||
currentDuration: currentDuration,
|
||||
});
|
||||
(0, utils_1.requestAnimationFrame)(function () {
|
||||
if (_this.status !== 'enter') {
|
||||
return;
|
||||
}
|
||||
_this.$emit('enter');
|
||||
_this.setData({
|
||||
inited: true,
|
||||
display: true,
|
||||
classes: classNames.enter,
|
||||
currentDuration: currentDuration,
|
||||
});
|
||||
(0, utils_1.requestAnimationFrame)(function () {
|
||||
if (_this.status !== 'enter') {
|
||||
return;
|
||||
}
|
||||
_this.transitionEnded = false;
|
||||
_this.setData({ classes: classNames['enter-to'] });
|
||||
resolve();
|
||||
});
|
||||
_this.transitionEnded = false;
|
||||
_this.setData({ classes: classNames['enter-to'] });
|
||||
resolve();
|
||||
});
|
||||
});
|
||||
},
|
||||
leave: function () {
|
||||
leave: function (resolve) {
|
||||
var _this = this;
|
||||
if (!this.enterFinishedPromise)
|
||||
if (!this.data.display) {
|
||||
return;
|
||||
this.enterFinishedPromise.then(function () {
|
||||
if (!_this.data.display) {
|
||||
}
|
||||
var _a = this.data, duration = _a.duration, name = _a.name;
|
||||
var classNames = getClassNames(name);
|
||||
var currentDuration = (0, validator_1.isObj)(duration) ? duration.leave : duration;
|
||||
this.status = 'leave';
|
||||
this.$emit('before-leave');
|
||||
(0, utils_1.requestAnimationFrame)(function () {
|
||||
if (_this.status !== 'leave') {
|
||||
return;
|
||||
}
|
||||
var _a = _this.data, duration = _a.duration, name = _a.name;
|
||||
var classNames = getClassNames(name);
|
||||
var currentDuration = (0, validator_1.isObj)(duration) ? duration.leave : duration;
|
||||
_this.status = 'leave';
|
||||
_this.$emit('before-leave');
|
||||
_this.$emit('leave');
|
||||
_this.setData({
|
||||
classes: classNames.leave,
|
||||
currentDuration: currentDuration,
|
||||
});
|
||||
(0, utils_1.requestAnimationFrame)(function () {
|
||||
if (_this.status !== 'leave') {
|
||||
return;
|
||||
}
|
||||
_this.$emit('leave');
|
||||
_this.setData({
|
||||
classes: classNames.leave,
|
||||
currentDuration: currentDuration,
|
||||
});
|
||||
(0, utils_1.requestAnimationFrame)(function () {
|
||||
if (_this.status !== 'leave') {
|
||||
return;
|
||||
}
|
||||
_this.transitionEnded = false;
|
||||
setTimeout(function () {
|
||||
_this.onTransitionEnd();
|
||||
_this.enterFinishedPromise = null;
|
||||
}, currentDuration);
|
||||
_this.setData({ classes: classNames['leave-to'] });
|
||||
});
|
||||
_this.transitionEnded = false;
|
||||
setTimeout(function () {
|
||||
_this.onTransitionEnd();
|
||||
resolve();
|
||||
}, currentDuration);
|
||||
_this.setData({ classes: classNames['leave-to'] });
|
||||
});
|
||||
});
|
||||
},
|
||||
|
||||
Reference in new issue
Block a user