fs-swipe-action-group.vue 511 B

1234567891011121314151617181920212223242526272829303132333435
  1. <template>
  2. <view><slot></slot></view>
  3. </template>
  4. <script setup>
  5. import { provide, reactive } from 'vue'
  6. const props = defineProps({
  7. autoClose: {
  8. type: Boolean,
  9. default: true
  10. }
  11. })
  12. const state = reactive({
  13. children: []
  14. })
  15. const updateChildren = child => {
  16. state.children.push(child)
  17. }
  18. const toggle = () => {
  19. if (props.autoClose) {
  20. state.children.forEach(child => {
  21. child.updateState()
  22. })
  23. }
  24. }
  25. provide('swipeGroup', {
  26. updateChildren,
  27. toggle
  28. })
  29. </script>
  30. <style lang="scss" scoped></style>