vue中改变选中当前项的显示隐藏或者状态的实现方法
作者:luckylqh 时间:2024-05-03 15:11:53
在vue中已经不像jq那样直接操作dom了,如果要指向当前选中项时,就不能再用jq的思路来做了,方法如下:
当指向一个状态的时候,只让指向的状态隐藏,其他项不变,如果项目中用了element-ui,那么操作起来会比较简单一些,这样设置:
v-if="(row.id == currentId&&row.auditState==0)?checkState:!checkState" @mouseover="statehidden(row.id)"
js中:
statehidden(id){
this.currentId=id;
},
这种方法的思路是:鼠标指向某一项时,获取到某一项的id存在一个变量中,判断row.id==currentId,控制这个按钮显示隐藏就可以了,因为只有在鼠标指向某一项的时候才能拿到当前项的id,所以可以利用row.id==currentId来判断,这样就能轻松实现控制当前项的变化
来源:http://blog.csdn.net/luckylqh/article/details/54584037
标签:vue,选中,显示,隐藏,状态
![](/images/zang.png)
![](/images/jiucuo.png)
猜你喜欢
Python 解决相对路径问题:"No such file or directory"
2022-03-16 21:45:05
![](https://img.aspxhome.com/file/2023/0/121140_0s.jpg)
分享Pandas库中的一些宝藏函数transform()
2022-05-03 17:24:44
![](https://img.aspxhome.com/file/2023/7/88017_0s.png)
IE地址栏显示网站图标制作方法
2007-10-13 11:08:00
一文带你了解MySQL中的事务
2024-01-19 00:21:16
![](https://img.aspxhome.com/file/2023/4/74794_0s.png)
详解uniapp页面跳转URL传参大坑
2023-09-15 09:52:43
Python协程实践分享
2023-09-01 05:50:51
![](https://img.aspxhome.com/file/2023/5/62875_0s.png)
python3 pygame实现接小球游戏
2023-07-28 18:04:21
![](https://img.aspxhome.com/file/2023/3/98863_0s.png)
PyTorch搭建ANN实现时间序列风速预测
2022-11-28 23:38:28
![](https://img.aspxhome.com/file/2023/4/75364_0s.png)
Python实现 PS 图像调整中的亮度调整
2021-04-02 20:08:54
BootStrap tooltip提示框使用小结
2023-07-02 05:25:25
asp中最新新闻显示new图片的实现代码
2012-11-30 20:31:42
MDB格式网站文件如何解压
2008-07-02 12:48:00
在Python中字符串、列表、元组、字典之间的相互转换
2021-08-30 07:09:42
![](https://img.aspxhome.com/file/2023/7/65497_0s.png)
解决vue watch数据的方法被调用了两次的问题
2024-05-05 09:10:33
DIV与Table布局在大型网站的可用性比较
2007-10-08 12:46:00
![](https://img.aspxhome.com/file/UploadPic/200710/8/2007108125233616s.jpg)
Tensorflow使用支持向量机拟合线性回归
2021-01-20 03:38:42
![](https://img.aspxhome.com/file/2023/7/92517_0s.jpg)
详解用python生成随机数的几种方法
2022-01-24 14:17:42
基于javascript实现全国省市二级联动下拉选择菜单
2023-09-14 06:08:52
![](https://img.aspxhome.com/file/2023/3/56303_0s.jpg)
Python里的dict和set的背后小秘密
2023-11-20 01:01:11
使用Python爬取小姐姐图片(beautifulsoup法)
2022-05-02 04:01:44
![](https://img.aspxhome.com/file/2023/4/133694_0s.png)