uni-swipe-action.vue 1.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  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 scoped>
  53. </style>