1234567891011121314151617181920212223242526272829303132333435 |
- <template>
- <view><slot></slot></view>
- </template>
- <script setup>
- import { provide, reactive } from 'vue'
- const props = defineProps({
- autoClose: {
- type: Boolean,
- default: true
- }
- })
- const state = reactive({
- children: []
- })
- const updateChildren = child => {
- state.children.push(child)
- }
- const toggle = () => {
- if (props.autoClose) {
- state.children.forEach(child => {
- child.updateState()
- })
- }
- }
- provide('swipeGroup', {
- updateChildren,
- toggle
- })
- </script>
- <style lang="scss" scoped></style>
|