直接上代码
<template v-for="item in searchlist"> <uni-tr> <uni-td align="center" class="table_text"><text @longpress="handleLongPress(item)">{{ item.Name}}</text></uni-td> <uni-td align="center" class="table_text"><text @longpress="handleLongPress(item)">{{ item.Detail}}</text></uni-td> <uni-td align="center" class="table_text"><text @longpress="handleLongPress(item)">{{ item.WaiGuan}}</text></uni-td> <uni-td align="center" class="table_text"><text @longpress="handleLongPress(item)">{{ item.Rfid}}</text></uni-td> </uni-tr> </template>
我记得el-table是可以上加click事件的,同理,我也操作了,怪自己没看文档,实际上它不支持click和longpress(长按)只能将此方法加到h5标签中。
错误代码如下:
<uni-tr v-for="item in searchlist" @longpress="handleLongPress(item)"> <uni-td align="center" class="table_text">{{ item.Name}}</uni-td> <uni-td align="center" class="table_text">{{ item.Detail}}</uni-td> <uni-td align="center" class="table_text">{{ item.WaiGuan}}</uni-td> <uni-td align="center" class="table_text">{{ item.Rfid}}</uni-td> </uni-tr>
这样看着是不是很合理???实际上,此长按事件一点反应都没有。
标签:Name,Rfid,tr,Detail,item,点击,uni,click From: https://www.cnblogs.com/xytx906/p/18355431