register.wxml
性别 {{ columns[gender] == "" ? "请输入性别" : "" }}{{ columns[gender] }}
register.js
Page({ /** * 页面的初始数据 */ data: { columns: ["未知", "男", "女"], gender: 0 || wx.getStorageSync("gender") * 1, }, pickSex: function(e) { this.setData({ gender: e.detail.value }); // console.log("当前选择性别-sex", e.detail.value); } })