Commit b1eda4b7 by zhangxw

自测修改

1 parent 6323ac5b
...@@ -4,22 +4,24 @@ Component({ ...@@ -4,22 +4,24 @@ Component({
* 组件的属性列表 * 组件的属性列表
*/ */
properties: { properties: {
show: Boolean, show: {
connectionList: Array, type: Boolean,
tabBarStyle: String,
selectedConnectionList: {
type: Array,
observer: function(n) { observer: function(n) {
let { connectionList } = this.data if (n) {
if (n?.length) { let { connectionList, selectedConnectionList } = this.data
connectionList.map(val => { connectionList.map(val => {
val.show = true val.show = true
if (n.findIndex(item => item.merchantId == val.merchantId) > -1) val.checked = true if (selectedConnectionList?.length && selectedConnectionList?.findIndex(item => item.merchantId == val.merchantId) > -1) val.checked = true
return val return val
}) })
this.setData({connectionList})
} }
this.setData({connectionList})
} }
},
connectionList: Array,
tabBarStyle: String,
selectedConnectionList: {
type: Array
} }
}, },
...@@ -36,11 +38,12 @@ Component({ ...@@ -36,11 +38,12 @@ Component({
methods: { methods: {
select(e) { select(e) {
let { item } = e.currentTarget.dataset let { item } = e.currentTarget.dataset
console.log(item)
let { connectionList } = this.data let { connectionList } = this.data
// 不可操作选项 // 不可操作选项
if (item.disabled) return if (item?.disabled) return
connectionList.forEach(v => { connectionList.forEach(v => {
if (v.merchantId == item.merchantId) v.checked = !v.checked if (v.merchantId == item?.merchantId) v.checked = !v.checked
}) })
this.setData({ this.setData({
connectionList connectionList
......
...@@ -38,7 +38,7 @@ ...@@ -38,7 +38,7 @@
<view <view
class="service-items text-hide" class="service-items text-hide"
data-index="{{index}}" data-index="{{index}}"
hidden="{{!item.show}}" data-item="{{item}}"
bindtap="select"> bindtap="select">
<view class="item-radio"> <view class="item-radio">
<view wx:if="{{!item.checked}}" class="radio_class radio {{item.disabled?'disabled': ''}}"></view> <view wx:if="{{!item.checked}}" class="radio_class radio {{item.disabled?'disabled': ''}}"></view>
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!