<radio-group bindchange="sexChange">
<radio value="male"/>男
<radio value="female"/>女
</radio-group>
如何button中选择setChange中的“男”或“女”?
sexChange: function(e){
this.setData({
'sex':e.detail.value
})
console.log('选择后的sex...',e.detail.value)
},
onSubmit (e) {
var sex = this.sex ;
if( 'this.data.sex' === "male" ){
this.setData({
eGFR:([140-this.data.Age]*this.data.Weight*88.4/this.data.Scr/72).toFixed(2)
})
console.log('male的男')
}
this.setData({
eGFR:([140-this.data.Age]*this.data.Weight*88.4*0.85/this.data.Scr/72).toFixed(2)
});
console.log('female的')
},
怎么总是显示"female的"的结果?
if( 'this.data.sex' === "male" )
应该怎样表达才行?
去掉引号,报错
取变量没有引号 if( this.data.sex === "male" )