Commit e08efb78a1e25e1aac6f7396ebf60759f56cd7a7

Authored by zhiyangdu
1 parent b61226c5

将tabbar下面组件换成可通用

src/components/tabBox/tabBox.vue
... ... @@ -3,7 +3,6 @@
3 3 <!-- 主内容区域 -->
4 4 <van-tabs @change="onChange" swipeable v-model="active" ellipsis swipe-threshold="3">
5 5 <van-tab v-for="(item,index) in tabbar" :key="index" :title="item.title">
6   -
7 6 </van-tab>
8 7 <div class="tabBox_main" ref="tabsSwiperBox">
9 8 <div class="tabbar" v-for="(item, index) in tabbaromponents&&tabbaromponents.ads" :key="index">
... ... @@ -72,7 +71,7 @@
72 71 name: 'name',
73 72 data () {
74 73 return {
75   - active: 1,
  74 + active: 0,
76 75 tabbaromponents: null, // 组件库
77 76 commoditys: { // 全部推荐
78 77 list: []
... ... @@ -98,8 +97,8 @@
98 97 },
99 98 created(){
100 99 // 初始化的时选中关爱屋
101   - if(this.tabbar&&this.tabbar[1]&&this.tabbar[1].ads){
102   - this.tabbaromponents = this.tabbar[1]
  100 + if(this.tabbar&&this.tabbar[0]&&this.tabbar[0].ads){
  101 + this.tabbaromponents = this.tabbar[0]
103 102 }
104 103 // 获取爱心屋全部商品数据
105 104 this.shopRecommendGoods(this.paging.commodity.page)
... ... @@ -143,8 +142,9 @@
143 142 * @param {int} page [页码]
144 143 */
145 144 shopRecommendGoods(page) {
146   - // 判断必要参数
147   - if (this.tabbar&&this.tabbar[2]&&this.tabbar[2].shop_id) {
  145 + for (let i = 0; i < this.tabbar.length; i++) {
  146 + // 判断必要参数
  147 + if (this.tabbar[i].ads[0].style==15) {
148 148  
149 149 // 加载中
150 150 this.$set(this.paging.commodity, "loading", true);
... ... @@ -154,12 +154,13 @@
154 154  
155 155 // 请求接口
156 156 this.http("/Api/" + (this.getApiVersion().index) + "/shopGoodsList", {
157   - shopId: this.tabbar[2].shop_id,
  157 + shopId: this.tabbar[i].shop_id,
158 158 page: page
159 159 }, this.shopRecommendGoodsCallback, {
160 160 method: "POST"
161 161 });
162 162 }
  163 + }
163 164 },
164 165  
165 166 /**
... ...