Commit e08efb78a1e25e1aac6f7396ebf60759f56cd7a7

Authored by zhiyangdu
1 parent b61226c5

将tabbar下面组件换成可通用

src/components/tabBox/tabBox.vue
@@ -3,7 +3,6 @@ @@ -3,7 +3,6 @@
3 <!-- 主内容区域 --> 3 <!-- 主内容区域 -->
4 <van-tabs @change="onChange" swipeable v-model="active" ellipsis swipe-threshold="3"> 4 <van-tabs @change="onChange" swipeable v-model="active" ellipsis swipe-threshold="3">
5 <van-tab v-for="(item,index) in tabbar" :key="index" :title="item.title"> 5 <van-tab v-for="(item,index) in tabbar" :key="index" :title="item.title">
6 -  
7 </van-tab> 6 </van-tab>
8 <div class="tabBox_main" ref="tabsSwiperBox"> 7 <div class="tabBox_main" ref="tabsSwiperBox">
9 <div class="tabbar" v-for="(item, index) in tabbaromponents&&tabbaromponents.ads" :key="index"> 8 <div class="tabbar" v-for="(item, index) in tabbaromponents&&tabbaromponents.ads" :key="index">
@@ -72,7 +71,7 @@ @@ -72,7 +71,7 @@
72 name: 'name', 71 name: 'name',
73 data () { 72 data () {
74 return { 73 return {
75 - active: 1, 74 + active: 0,
76 tabbaromponents: null, // 组件库 75 tabbaromponents: null, // 组件库
77 commoditys: { // 全部推荐 76 commoditys: { // 全部推荐
78 list: [] 77 list: []
@@ -98,8 +97,8 @@ @@ -98,8 +97,8 @@
98 }, 97 },
99 created(){ 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 this.shopRecommendGoods(this.paging.commodity.page) 104 this.shopRecommendGoods(this.paging.commodity.page)
@@ -143,8 +142,9 @@ @@ -143,8 +142,9 @@
143 * @param {int} page [页码] 142 * @param {int} page [页码]
144 */ 143 */
145 shopRecommendGoods(page) { 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 this.$set(this.paging.commodity, "loading", true); 150 this.$set(this.paging.commodity, "loading", true);
@@ -154,12 +154,13 @@ @@ -154,12 +154,13 @@
154 154
155 // 请求接口 155 // 请求接口
156 this.http("/Api/" + (this.getApiVersion().index) + "/shopGoodsList", { 156 this.http("/Api/" + (this.getApiVersion().index) + "/shopGoodsList", {
157 - shopId: this.tabbar[2].shop_id, 157 + shopId: this.tabbar[i].shop_id,
158 page: page 158 page: page
159 }, this.shopRecommendGoodsCallback, { 159 }, this.shopRecommendGoodsCallback, {
160 method: "POST" 160 method: "POST"
161 }); 161 });
162 } 162 }
  163 + }
163 }, 164 },
164 165
165 /** 166 /**