zxl
2025-05-23 5d5b0f7ab0f34019e11901ddcd59cd8b51ea9ff9
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
<template>
  <div class="wrapper">
    <Tabs :value="wap[0].title" class="tabs">
      <TabPane
        :label="item.title"
        :name="item.title"
        @click="clickTag(item, i)"
        v-for="(item, i) in wap"
        :key="i"
      >
        <component
          ref="lili-component"
          :is="templateWay[item.name]"
          @selected="
            (val) => {
              changed = val;
            }
          "
        />
      </TabPane>
      <!-- </template> -->
    </Tabs>
  </div>
</template>
<script>
import wap from "./wap.js";
import goodsDialog from "./goods-dialog";
import templateWay from "./template/index";
export default {
  components: {
    goodsDialog
  },
  data() {
    return {
      templateWay, // 模板数据
      changed: "", // 变更模板
      selected: 0, // 已选数据
      selectedLink: "", //选中的链接
      wap, // tab标签
    };
  },
  watch: {
    changed: {
      handler(val) {
        console.log(val,'changed')
        this.$emit("selectedLink", val[0]); //因为是单选,所以直接返回第一个
      },
      deep: true
    }
  },
  mounted() {
    this.$nextTick(() => {
      this.$refs["lili-component"][0].type = "single"; //商品页面设置成为单选
    });
    let url  = window.location.href
    if(url.indexOf('/floorList/renovation') != -1){
      //此处去重防止移动楼层多次点击push 太多数据
      let obj = {};
            this.wap = this.wap.reduce((cur, next) => {
              //对象去重
              if (next.title != undefined) {
                obj[next.title]
                  ? ""
                  : (obj[next.title] = true && cur.push(next));
              }
              return cur;
      }, []);
      this.wap.forEach((items,indexs) => {
        if(items.title == '活动'){
          this.wap.splice(indexs,1)
        }
      })
    }else{
      this.wap.push( {
        title: "活动",
        url: "3",
        name: "marketing"
      })
      let obj = {};
            this.wap = this.wap.reduce((cur, next) => {
              //对象去重
              if (next.title != undefined) {
                obj[next.title]
                  ? ""
                  : (obj[next.title] = true && cur.push(next));
              }
              return cur;
      }, []);
    }
    this.wap.forEach((item) => {
      if (item) {
        item.selected = false;
      }
    });
  },
  methods: {
    // isVisible(item) {
    //   const type = this.$route.query.pagetype;
    //   if (type == "INDEX" && [ "discover"].includes(item.name)) {
    //     return false;
    //   }else if(type == "DISCOVER" && item.name == 'special'){
    //     return false;
    //   }else{
    //     return true
    //   }
    // },
  }
};
</script>
<style scoped lang="scss">
@import "./style.scss";
.wap-content-list {
  display: flex;
  flex-wrap: wrap;
}
.wap-flex {
  margin: 2px;
}
.tabs {
  width: 100%;
}
 
/deep/ .ivu-modal {
  overflow: hidden;
  height: 650px !important;
}
/deep/ .ivu-modal-body {
  width: 100%;
  height: 500px;
  overflow: hidden;
}
</style>