Skip to content

微信小程序 ,popup 的属性 visible 接收的是boolean值,但是监听里面是处理的对象,导致关闭popup的时候动画消失 #1347

Open
@1369220324

Description

onAnimationEnd() {
const { closing } = this.data;
if (closing) {
this.setData({ closing: false });
}
const [visible, duration, animation] = getValueFromProps(this, [
'visible',
'duration',
'animation',
]);
const enableAnimation = animation && duration > 0;
if (enableAnimation) {
triggerEventOnly(this, visible ? 'afterShow' : 'afterClose');
}

/// #if WECHAT
observers: {
'visible': function (nextProps) {
const { visible, duration, animation } = nextProps;
const enableAnimation = animation && duration > 0;
if (enableAnimation && !visible && !this.data.closing) {
this.setData({ closing: true });
}
if (!enableAnimation) {
triggerEventOnly(this, visible ? 'afterShow' : 'afterClose');
}
},
},
/// #endif

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions