<template>
	<view><slot></slot></view>
</template>

<script>
/**
 * 滑动面板组件
 * @description 滑动面板组件
 * @property {Boolean} autoClose 是否自动关闭其他swipe按钮组
 */
export default {
	name: 'fs-swipe-action-group'
}
</script>

<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>
