framework7滑动删除列表触发chrome 报错解决办法

时间:2024-08-21 22:36:50

使用

<div class="list-block">
<ul>
<li class="swipeout">
<div class="swipeout-content item-content">
<div class="item-inner">张三</div>
</div>
<div class="swipeout-actions-right">
<a href="#" class="action1 bg-red">删除</a>
</div>
</li>
<li class="swipeout">
<div class="swipeout-content item-content">
<div class="item-inner">李四</div>
</div>
<div class="swipeout-actions-right">
<a href="#" class="action1 bg-red">删除</a>
</div>
</li>
</ul>
</div>

这段代码的时候,滑动删除按钮会在PC的谷歌上报出  framework7.min.js:4 [Intervention] Unable to preventDefault inside passive event listener due to target being treated as passive. See https://www.chromestatus.com/features/5093566007214080

的错误提示,这里应该是和谷歌设置了被动监听有关系,这里的处理办法是在

swipeout 或者
swipeout-content上加入样式:
.swipeout-content {
touch-action: none;
}

问题解决,*原文:

If you're call preventDefault on every touchstart then you should also have a CSS rule to disable touch scrolling like .sortable-handler { touch-action: none; }