微信小程序 点击分享之类的按钮,会向上穿透

官方文档说:hover-stop-propagation 指定是否阻止本节点的祖先节点出现点击态

 

 

 

 

但是在 button 中,不管是否写 hover-stop-propagation='true' 或者 hover-stop-propagation='{{ true }}',都无法阻止祖先节点穿透,

所以,需要在 button 外部加个阻止穿透的节点view:
<view catchtap='shareBtn'>
    <button plain="true" open-type="share" class="shareBtn" data-title="{{ item.a_shortTitle }}" data-abstract="{{ item.a_abstract }}" data-image="{{ item.a_picBig }}" hover-stop-propagation="{{true}}">
        <image class="shareImg" src="../../../images/shareImg.png" mode="aspectFill" />
    </button>
</view>

 

posted @ 2023-04-14 10:48  小蘑菇123  阅读(302)  评论(0编辑  收藏  举报