You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

58 lines
1.1 KiB

3 years ago
  1. <template>
  2. <view>
  3. <slot></slot>
  4. </view>
  5. </template>
  6. <script>
  7. /**
  8. * SwipeAction 滑动操作
  9. * @description 通过滑动触发选项的容器
  10. * @tutorial https://ext.dcloud.net.cn/plugin?id=181
  11. */
  12. export default {
  13. data() {
  14. return {};
  15. },
  16. provide() {
  17. return {
  18. swipeaction: this
  19. }
  20. },
  21. created() {
  22. this.children = []
  23. },
  24. methods: {
  25. closeOther(vm) {
  26. let children = this.children
  27. children.forEach((item, index) => {
  28. if (vm === item) return
  29. // 支付宝执行以下操作
  30. // #ifdef MP-ALIPAY
  31. if (item.isopen) {
  32. item.close()
  33. }
  34. // #endif
  35. // app vue 端、h5 、微信、支付宝 执行以下操作
  36. // #ifdef APP-VUE || H5 || MP-WEIXIN
  37. let position = item.position[0]
  38. let show = position.show
  39. if (show) {
  40. position.show = false
  41. }
  42. // #endif
  43. // nvue 执行以下操作
  44. // #ifdef APP-NVUE || MP-BAIDU || MP-QQ || MP-TOUTIAO
  45. item.close()
  46. // #endif
  47. })
  48. }
  49. }
  50. }
  51. </script>
  52. <style>
  53. </style>