123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384 |
- <template>
- <view class="u-swipe-action">
- <slot></slot>
- </view>
- </template>
- <script>
- import { props } from './props';
- import { mpMixin } from '../../libs/mixin/mpMixin';
- import { mixin } from '../../libs/mixin/mixin';
-
- export default {
- name: 'u-swipe-action',
- mixins: [mpMixin, mixin, props],
- data() {
- return {}
- },
- provide() {
- return {
- swipeAction: this
- }
- },
- computed: {
-
-
-
- parentData() {
- return [this.autoClose]
- }
- },
- emits: ['opendItem:update'],
- watch: {
-
- parentData() {
- if (this.children.length) {
- this.children.map(child => {
-
- typeof(child.updateParentData) === 'function' && child.updateParentData()
- })
- }
- },
- opendItem(val) {
- if (val == false) {
- this.closeAll()
- }
- }
- },
- created() {
- this.children = []
- },
- methods: {
- closeOther(child) {
- if (this.autoClose) {
-
- this.children.map((item, index) => {
- if (child !== item) {
- item.closeHandler()
- }
- })
- }
- },
- closeAll() {
-
- this.children.map((item, index) => {
- item.closeHandler()
- })
- },
- setOpendItem(ins) {
- this.$emit('opendItem:update', true)
- }
- }
- }
- </script>
- <style lang="scss" scoped>
- </style>
|