Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[t-popup] close-on-overlay-click属性为true无法点击遮罩层时关闭弹窗 #2660

Open
DdYy-15 opened this issue Mar 21, 2024 · 6 comments
Labels
question This is a question, not a bug

Comments

@DdYy-15
Copy link

DdYy-15 commented Mar 21, 2024

tdesign-miniprogram 版本

1.2.9

重现链接

No response

重现步骤

在uniapp中使用popup组件,并设置了close-on-overlay-click属性



<view class="btn btn--cancel" aria-role="button" @click="tagVisibleCancel">取消
企业标签
<view class="btn btn--confirm" aria-role="button" @click="tagVisibleConfirm">确定


期望结果

期望点击遮罩层时,弹窗关闭

实际结果

点击遮罩层,没反应

基础库版本

No response

补充说明

No response

Copy link
Contributor

👋 @DdYy-15,感谢给 TDesign 提出了 issue。
请根据 issue 模版确保背景信息的完善,我们将调查并尽快回复你。

@DdYy-15
Copy link
Author

DdYy-15 commented Mar 21, 2024

代码片段在这里
<t-popup :visible="tagVisible" placement="bottom" close-on-overlay-click>
<view class="block">
<view class="header">
<view class="btn btn--cancel" aria-role="button" @click="tagVisibleCancel">取消</view>
<view class="title">企业标签</view>
<view class="btn btn--confirm" aria-role="button" @click="tagVisibleConfirm">确定</view>
</view>
</view>
</t-popup>

@betavs
Copy link
Collaborator

betavs commented Mar 21, 2024

<t-popup :visible="tagVisible" placement="bottom" close-on-overlay-click  bind:visible-change="onVisibleChange">
onVisibleChange(e) {
  this.setData({
    tagVisible: e.detail.visible,
  })
}

@betavs betavs added the question This is a question, not a bug label Mar 21, 2024
@DdYy-15
Copy link
Author

DdYy-15 commented Mar 22, 2024

<t-popup :visible="tagVisible" placement="bottom" close-on-overlay-click  bind:visible-change="onVisibleChange">
onVisibleChange(e) {
  this.setData({
    tagVisible: e.detail.visible,
  })
}

不行呢,这样写了之后onVisibleChange函数没有被调用。在uniapp中我是这样写的:

<t-popup :visible="tagVisible" placement="bottom" close-on-overlay-click @visible-change="onVisibleChange">
onVisibleChange(e) {
    console.log('change', e)
    this.tagVisible = e.detail.visible;
},

@betavs
Copy link
Collaborator

betavs commented Mar 22, 2024

方便提供复现的代码仓库以便定位问题 🤔

@mayday97
Copy link

这个问题我这边也遇到了,感觉主要还是uniapp 编译有问题吧,你写的@visible-change ,uni编译会变成 bindvisiblechange,而腾讯这个组件this.triggerEvent('visible-change', { visible: false });
我目前是手动把腾讯 组件 的改成 this.triggerEvent('visiblechange', { visible: false }); 就可以了 @DdYy-15

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question This is a question, not a bug
Projects
None yet
Development

No branches or pull requests

3 participants