picker选择确定后,this.setData成功,页面不刷新?

小程序 文章 2022-01-07 09:40 1071 0 全屏看文

AI助手支持GPT4.0

picker选择确定后,this.setData成功,页面不刷新?After the picker is selected, this.setData is successful, but the page does not refresh?

picker选择确定后,this.setData成功,页面不刷新?

wxml部分代码:

<picker bindchange="bindPickerChange" value="{{index}}" range="{{userCouponList}}" range-key="name">            <view>{{index}}</view>            <view class="picker">              当前选择:{{userCouponList[index].name}}            </view></picker>

js部分代码:

bindPickerChange: function(e{    console.log('picker发送选择改变,携带值为', e.detail.value)    this.setData({      index: e.detail.value    })    console.log(this.data.index)},


index初始值为0,选择第二个选项以后,index被更新成1,但是页面不会刷新,还是原来的值。

页面如图

-------------------------------------

控制台输出图

可以看到this.data.index更新成功了,页面不会刷新。picker的js复制的官方代码,使用官方示例是可以成功刷新页面的,没搞明白,求解,整了几个小时试了各种方法都没用,已经裂开,求大佬解答

Wxml part code: < picker bindchange = "bindpickerchange" value = "{index}" range = "{usercouponlist}" range key = "name" > < View > {index} < / View > < view class = "picker" > current selection: {{usercouponlist [index]. Name} }< / View > < / picker > JS part of code: bindpickerchange: function (E) {console.log ('picker sends selection change, carrying value ', e.detail. Value) this.setdata ({index: e.detail. Value}) console Log (this. Data. Index)}, the initial value of index is 0. After selecting the second option, the index will be updated to 1, but the page will not be refreshed, but the original value will still be used. The page is as shown in the figure ---------------------------------------- this can be seen in the console output diagram data. The index update is successful. The page will not be refreshed. The official code copied by picker's JS can successfully refresh the page using the official example. I didn't understand it and solved it. I tried all kinds of methods for several hours, but it's useless. It's cracked. Ask the boss for an answer

回答:

15:

你试试把 e.detail.value 这里写死的话有改变吗

this.setData({  index1})


destiny:

检查appdata面板

brave:

你好这边测试正常,提供下可以复现问题的代码片段 https://developers.weixin.qq.com/miniprogram/dev/devtools/minicode.html

微喵网络:

检查appdata面板

-EOF-

AI助手支持GPT4.0


国内超级便宜服务器

摸鱼人热门新闻聚合

钻级赞助商 我要加入

开发者在线工具

第三方支付技术请加QQ群

相关文章
获取头像地址正确,但URL对应图片显示错误?
服务商下的子商户是不是不能自己创建代金券?
小程序后台配置了socket域名,但是微信开发工具还是提示域名不合法?
3月1日新规后,服务商如何帮无营业执照的小商户开通微信支付?
企业微信的自建应用 wx.previewFile is not a function
随便看看
微信公众号免300认证教程 5113
小程序已经上线,作为管理员无法在小程序数据助手查看数据? 4425
小程序广告组件通过审核,但是小程序内没有显示广告? 4397
企业微信通讯录账号被管理员误/恶意删除,怎么办? 8432
问题? 7651
如何快速搭建抽奖助手小程序(无需代码知识) 5218
许涛 大哥在吗, 要解冻小程序的时候提示信息主体不一致, 能帮忙看下吗? 6488
小程序搜一搜全称搜索不显示 麻烦解决一下!谢谢 5787
我的小程序广告收款主体是个体工商户,每个月邮寄两次发票很是麻烦,我年底的时候打包邮寄一次可以么? 5449
如何解决渲染层网络错误Failed to load media? 16697