欢迎您访问 最编程 本站为您分享编程语言代码,编程技术文章!
您现在的位置是: 首页

uni-app中的事件及其绑定方法

最编程 2024-08-07 14:28:36
...

事件修饰符 stop的使用会阻止冒泡,但是同时绑定了一个非冒泡的事件,会导致该元素上的catchEventName失效!

prevent可以直接干掉,因为uni-app里没有什么默认事件,比如submit并不会跳转页面。

self没有可以判断的标识

once也不能做,因为uni-app没有removeEventListener,虽然可以直接在handleProxy中处理,但非常的不优雅,违背了愿意,暂不考虑按键修饰符:uni-app运行在手机端,没有键盘事件,所以不支持按键修饰符。

view 视图容器

hover-class 类型为string,默认值none 指定按下去的样式类,类hover-class="none"时,没有点击态效果

hover-stop-propagation 类型boolean,默认值false 指定是否阻止本节点的祖先节点出现点击态

hover-start-time 类型number,默认值50 按住后多久出现点击态

hover-stay-time 类型number,默认值400 手指松开后点击态保留时间

<picker :range="years" @change="yearChange" mode="multiSelector">
 <view>
  {{years[0] [yearIndex1]}} {{years[1][yearIndex2]}}
 </view>
</picker>

file

<swiper :indicator-dots="indicatorDots" :autoplay="autoplay" :interval="interval" :duration="duration">
</swiper>
<view class="demo" @click="clickTest" @longtap="longtap"></view>

methods:{
  clickTest: function(e){
   console.log(e);
   console.log('click');
  },
  longtap: function(e){
   console.log(e);
   console.log('longtap');
  }
 }
<view v-for="(item, index) in students" class="persons" @click="menuClick" v-bind:id="index">{{index}} - {{item.name}}</view>
methods:{
 menuClick : function(e){
  console.log(e);
  console.log(e.target.id);
 }
 },

stop 的使用会阻止冒泡


若本号内容有做得不到位的地方(比如:涉及版权或其他问题),请及时联系我们进行整改即可,会在第一时间进行处理。