uni-app long press event

<view class="list" @longpress="logoTime" >
</view>

methods: {
console.log("啊哈哈哈");
}

 

For example: I need the check box to be hidden here, and the check box is displayed after long pressing.

First: Use the v-if loop on the check box component.

 <view class="file-item-ckb"  v-if="Doubleselection">
         
 </view>



 props: {
          Doubleselection:{
              type:Boolean,
              default:false
          }
    },

The second reference in the main interface,

<view class="list" @longpress="logoTime" >
<FileItem   :key="index" :Doubleselection="Doubleselection" />
</view>


data() {

return {
Doubleselection:false,

}}


methods: {
 logoTime(
                //console.log("ahahahh");
        this.Doubleselection=true;
       },

}

 

Guess you like

Origin www.cnblogs.com/lovebear123/p/12689476.html