使用修飾符時,順序很重要;相應的代碼會以同樣的順序產生。因此,用 v-on:click.prevent.self
會阻止所有的點擊,而 v-on:click.self.prevent
只會阻止對元素自身的點擊。
注意
- 為兼容各端,事件需使用 v-on 或 @ 的方式綁定,請勿使用小程序端的
bind
和catch
進行事件綁定。 - 若需要禁止蒙版下的頁面滾動,可使用
@touchmove.stop.prevent="moveHandle"
,moveHandle
可以用來處理touchmove
的事件,也可以是一個空函數。
<view class="mask" @touchmove.stop.prevent="moveHandle"></view>