Skip to content

Commit

Permalink
feat: swipe-action增加closeAll方法
Browse files Browse the repository at this point in the history
  • Loading branch information
jry committed Aug 16, 2024
1 parent c22351b commit 2b2248d
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -127,8 +127,13 @@
// #ifndef APP-NVUE
wxsInit(newValue, oldValue) {
this.queryRect()
}
},
// #endif
status(newValue) {
if (newValue === 'open') {
this.parent && this.parent.setOpendItem(this)
}
}
},
computed: {
wxsInit() {
Expand Down
5 changes: 5 additions & 0 deletions src/uni_modules/uview-plus/components/u-swipe-action/props.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,11 @@ export const props = defineMixin({
autoClose: {
type: Boolean,
default: () => defProps.swipeAction.autoClose
},
// 是否存在打开的按钮组
opendItem: {
type: Boolean,
default: false
}
}
})
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
return [this.autoClose]
}
},
emits: ['opendItem:update'],
watch: {
// 当父组件需要子组件需要共享的参数发生了变化,手动通知子组件
parentData() {
Expand All @@ -45,6 +46,11 @@
})
}
},
opendItem(val) {
if (val == false) {
this.closeAll()
}
}
},
created() {
this.children = []
Expand All @@ -59,6 +65,15 @@
}
})
}
},
closeAll() {
// 关闭所有单元格
this.children.map((item, index) => {
item.closeHandler()
})
},
setOpendItem(ins) {
this.$emit('opendItem:update', true)
}
}
}
Expand Down

0 comments on commit 2b2248d

Please sign in to comment.