扩大问诊开关的点击区域

This commit is contained in:
haomingming
2023-05-25 09:44:17 +08:00
parent bd97a69fb4
commit 70dca249c3
6 changed files with 76 additions and 25 deletions
+18 -1
View File
@@ -62,17 +62,34 @@ Page({
}).catch(errors => {console.error(errors);})
},
changeON(){
let is_open = this.data.info.is_open
console.log("changeON:", is_open)
let detail = false
if(is_open == 0){
detail = true
}else{
detail = false
}
this.doChange(detail)
},
onChange({ detail }) {
console.log("onChange: ", detail);
this.doChange(detail)
},
doChange(detail){
let is_open = 0;
if(detail){
this.setData({ note: this.data.open_note });
wx.vibrateShort({
"type": "heavy"
})
is_open = 1
}else{
this.setData({ note: this.data.close_note });
is_open = 0
}
this.setData({ "info.is_open": detail });
this.setData({ "info.is_open": is_open });
//修改开关
let params = {};
+3 -3
View File
@@ -2,15 +2,15 @@
<view class="container">
<view class="switch_box">
<view class="switch_box_top">
<view class="switch_box_item">
<view class="switch_box_item" bindtap="changeON">
<view class="switch_box_item_name">接诊开关</view>
<view class="switch_box_item_btn">
<van-switch
active-color="#3CC7C0"
inactive-color="#E7E7E7"
size="40rpx"
checked="{{ info.is_open==1 }}"
bind:change="onChange" />
checked="{{ info.is_open==1 }}"
/>
</view>
</view>
<view class="switch_box_note">{{ note }}</view>