We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
问题描述 js代码设置picker-view的value值,如果value下标为0的值是0是触发不了界面改变的,反而大于0可以,在小程序运行没有问题,就H5运行有问题
复现步骤 添加了一个按钮修改日期,修改value的值为[0,2,2],没有效果,如果把value第一项设置为大于0就可以改变界面
<template> <view> <page-head :title="title"></page-head> <view class="uni-padding-wrap"> <view class="uni-title"> 日期:{{year}}年{{month}}月{{day}}日 </view> </view> <picker-view v-if="visible" :indicator-style="indicatorStyle" :value="value" @change="bindChange"> <picker-view-column> <view class="item" v-for="(item,index) in years" :key="index">{{item}}年</view> </picker-view-column> <picker-view-column> <view class="item" v-for="(item,index) in months" :key="index">{{item}}月</view> </picker-view-column> <picker-view-column> <view class="item" v-for="(item,index) in days" :key="index">{{item}}日</view> </picker-view-column> </picker-view> <button @tap="changeDate">修改日期</button> </view> </template> <script> export default { data () { const date = new Date() const years = [] const year = date.getFullYear() const months = [] const month = date.getMonth() + 1 const days = [] const day = date.getDate() for (let i = 1990; i <= date.getFullYear(); i++) { years.push(i) } for (let i = 1; i <= 12; i++) { months.push(i) } for (let i = 1; i <= 31; i++) { days.push(i) } return { title: 'picker-view', years, year, months, month, days, day, value: [9999, month - 1, day - 1], /** * 解决动态设置indicator-style不生效的问题 */ visible: true, indicatorStyle: `height: ${Math.round(uni.getSystemInfoSync().screenWidth/(750/100))}px;` } }, methods: { bindChange (e) { const val = e.detail.value this.year = this.years[val[0]] this.month = this.months[val[1]] this.day = this.days[val[2]] }, changeDate(){ this.value=[0,2,2]//this.value=[3,2,2] } } } </script> <style> picker-view { width: 100%; height: 600upx; margin-top:20upx; } .item { line-height: 100upx; text-align: center; } </style>
预期结果 改变value的值改变界面
系统信息:
The text was updated successfully, but these errors were encountered:
fix: 修复 picker-view 组件某些情况 value 变更无法检测的问题 fixed #1290 #1162
cefdbf8
问题已解决,感谢大神
Sorry, something went wrong.
No branches or pull requests
问题描述
js代码设置picker-view的value值,如果value下标为0的值是0是触发不了界面改变的,反而大于0可以,在小程序运行没有问题,就H5运行有问题
复现步骤
添加了一个按钮修改日期,修改value的值为[0,2,2],没有效果,如果把value第一项设置为大于0就可以改变界面
预期结果
改变value的值改变界面
系统信息:
The text was updated successfully, but these errors were encountered: