I am experiencing some problems when I use the Radio button to configure the default value:
<! -- gender --> <van-cell title=" gender" > <van-radio-group slot="value" name="gender" value="{{gender}}" bind:change="genderChange" style="display:flex; flex-flow:row nowarp; justify-content:flex-end;" > <van-radio name="0" checked-color="#25B077" style="margin-right:40rpx;" > female </van-radio> <van-radio name="1" checked-color="#25B077"> male </van-radio> </van-radio-group> </van-cell> data: {gender: 0} and the database of gender, but also to tinyInteger type storage: 0-1 - male female | Get data from the backend: this. Gender = user. The gender of the code above, looking at without any problems. And in the payment page, when choosing the payment method, the same Radio code, but the name value is offline and online, there is no problem to set the default value! So, this time, no debugging is correct, very strange, suspected 'data type' problem, so I tried to set gender to '0' data: {gender: Gender = (user.gender + ") success!!!Copy the code
View the source code, found that the use of judgment ‘===’ identity, also carried out a type judgment, so lead to this problem. Record!