for循环出的数据,删除其中一条或者多条,怎么才能让页面保持在当前位置,同时删除的这条数据消失?

小程序 文章 2021-03-24 11:21 403 0 全屏看文

AI助手支持GPT4.0

for循环出的数据,删除其中一条或者多条,怎么才能让页面保持在当前位置,同时删除的这条数据消失?For the data looped out, delete one or more of them, how can we keep the page at the current position and the deleted data disappear?

for循环出的数据,删除其中一条或者多条,怎么才能让页面保持在当前位置,同时删除的这条数据消失?

第一种办法是点击删除刷新页面重新调用接口,但是因为接口是分页的,所以没办法保持原来的浏览进度(分页每次只查询十条数据)

第二种就是不刷新页面给删除的数据进行隐藏,但是小程序只支持变量赋值的方式来控制隐藏和显示,这样就只能隐藏一条数据,隐藏第二条数据的话,第一条数据就显示出来了

The first method is to click Delete to refresh the page and call the interface again, but because the interface is paginated, it can't keep the original browsing progress (only query ten pieces of data each time in pagination). The second method is not to refresh the page to hide the deleted data, but the applet only supports variable assignment to control the hiding and display, so only one piece of data can be hidden, If the second data is hidden, the first data will be displayed

回答:

跨商通:

在这个数组元素上加个标签:isDeleted:true

Brother斌🎈:

list:[{data:1,hide:false},{data:1,hide:true},{data:1,hide:false},{data:1,hide:true}]

<block wx:for="{{list}}">

<view wx:if="{{!item.hide}}">.....</view>

</block>

叶⃰子⃰:

怎么样用同一个方法,给不同的view设置隐藏状态呢

-EOF-

AI助手支持GPT4.0


国内超级便宜服务器

摸鱼人热门新闻聚合

钻级赞助商 我要加入

开发者在线工具

第三方支付技术请加QQ群

相关文章
InvalidKeyException: Illegal key size?
小程序直播列表无法删除,提示系统错误稍候再试
请问怎么查询一个微信号绑定了多少个公众平台?
小程序是否可以通过点击链接进入到公众号查看已发布或未发布的文章?
公众号appid和公众号appsecret是开发者ID和开发者密码(AppSecret)?
随便看看
教育科技公司申请微信支付被拒绝? 4178
微信公众号免300认证教程 5319
小程序已经上线,作为管理员无法在小程序数据助手查看数据? 4619
小程序广告组件通过审核,但是小程序内没有显示广告? 4497
企业微信通讯录账号被管理员误/恶意删除,怎么办? 8565
问题? 8282
如何快速搭建抽奖助手小程序(无需代码知识) 5341
许涛 大哥在吗, 要解冻小程序的时候提示信息主体不一致, 能帮忙看下吗? 6712
小程序搜一搜全称搜索不显示 麻烦解决一下!谢谢 5995
我的小程序广告收款主体是个体工商户,每个月邮寄两次发票很是麻烦,我年底的时候打包邮寄一次可以么? 5549