性别
register.wxml
<view class="form-item list-msg">
<text class="item_name">性别</text>
<picker bindchange="pickSex" value="{{ gender }}" class="sex" range="{{ columns }}">
<view>
{{ columns[gender] == "" ? "请输入性别" : "" }}{{ columns[gender] }}
</view>
</picker>
</view>
<view class="form-item list-msg">
<text class="item_name">性别</text>
<picker bindchange="pickSex" value="{{ gender }}" class="sex" range="{{ columns }}">
<view>
{{ columns[gender] == "" ? "请输入性别" : "" }}{{ columns[gender] }}
</view>
</picker>
</view>
register.js
Page({
columns: ["未知", "男", "女"],
gender: 0 || wx.getStorageSync("gender") * 1,
})
pickSex: function(e) {
this.setData({
gender: e.detail.value
});
// console.log("当前选择性别-sex", e.detail.value);
},
Page({
columns: ["未知", "男", "女"],
gender: 0 || wx.getStorageSync("gender") * 1,
})
pickSex: function(e) {
this.setData({
gender: e.detail.value
});
// console.log("当前选择性别-sex", e.detail.value);
},