uni常用的事件
发布于:2022-02-19 16:44:54
次阅读
<template> <view class="content"> <view class="" > <input style="background: #008000;" type="text" @input="input" @blur="blur()" @focus="focus()" @confirm="confirm" @click="click" @tap="tap" @longpress="logpress()" > <br> <br> <br> <br> <button type="default" @touchstart="touchstart" @touchend="touchend" @touchmove="touchmove" @touchcancel="touchcancel" >触摸测试 </button> </view> </view></template><script> export default { data() { return {} }, methods: { input(){ console.log("input的val") }, blur(){ console.log("失去了焦点") }, focus(){ console.log("获取了焦点") }, confirm(){ console.log('回车') }, click(){ console.log('单机事件') }, tap(){ //手机端的触摸事件优先级比click高 console.log('手机端的点击事件') }, logpress(){ console.log('手机端的长按事件') }, touchstart(){ console.log('触摸开始') }, touchend(){ console.log('触摸结束') }, touchmove(){ console.log('触摸移动') }, touchcancel(){ console.log('触摸被打断') } } }</script><style></style>