v3.0 推出后反饋最多的問題之一,就是在 touchmove
事件回調中調用 e.stopPropagation()
並不能阻止滑動穿透。
這是因為 Taro 3 的事件冒泡機制是單獨在小程序邏輯層實現,所有事件都是綁定的 bind
而不是 catch
。因此touchmove
事件回調中調用 e.stopPropagation()
只會阻止上層組件的事件回調觸發,而沒有 catchtouchmove
能阻止滑動穿透的能力。
v3.1 中我們為 View
組件增加了 catchMove
屬性,只要 catchMove
屬性值為 true
,就會使用 catchtouchmove
代替 bindtouchmove
進行事件綁定,從而獲得阻止滑動穿透的能力。
用法:
<View class='parent'>
<View class='modal' catchMove>滑動 .modal 時,並不會令 .parent 也一起滑動</View>
</View>
路由navigateTo傳參,新頁面接收參數

Taro.getCurrentInstance().router.params.id
Taro小程序tabbar默認緩存數據不更新,在tabbar頁面例如pagelist
小程序掃碼進入 l047
小程序分包:將tabbar頁面放到主包,其他可以分包來按需加載(微信默認)
Taro 小程序入口 React FC 的onLauch事件怎么寫
Taro.getLaunchOptionsSync() 對應Class 組件中的 App.onLaunch
