user_group.vue 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. <template>
  2. <view class="user-group">
  3. <tabs :active="active" @change="changeShow" :isScroll="false">
  4. <tab v-for="(item, index) in group" :key="index" :name="item.name">
  5. <group-list v-if="item.isShow" :ref="'group' + item.type" :groupType="item.type"></group-list>
  6. </tab>
  7. </tabs>
  8. </view>
  9. </template>
  10. <script>
  11. import {groupType} from "@/utils/type";
  12. export default {
  13. data() {
  14. return {
  15. active: "",
  16. group: [{
  17. name: '全部',
  18. type: groupType.ALL,
  19. isShow: true
  20. }, {
  21. name: '拼团中',
  22. type: groupType.PROGESS,
  23. isShow: false
  24. }, {
  25. name: '拼团成功',
  26. type: groupType.SUCCESS,
  27. isShow: false
  28. }, {
  29. name: '拼团失败',
  30. type: groupType.FAIL,
  31. isShow: false
  32. }]
  33. };
  34. },
  35. onLoad: function(options) {
  36. const {
  37. group
  38. } = this
  39. let type = options.type || groupType.ALL;
  40. let index = group.findIndex(item => item.type == type)
  41. this.changeShow(index);
  42. },
  43. methods: {
  44. changeShow(index) {
  45. if (index != -1) {
  46. this.active = index
  47. this.group[index].isShow = true
  48. }
  49. },
  50. }
  51. };
  52. </script>
  53. <style>
  54. </style>