Authored by 陈轩

fix list state

... ... @@ -16,10 +16,10 @@
</div>
</li>
</ul>
<p class="cardlist--loading text-center" v-show="inLoading">正在加载...</p>
<p class="cardlist--end text-center" v-show="atEnd ">--End--</p>
<p class="cardlist--loading text-center" v-show="state === 1">正在加载...</p>
<p class="cardlist--end text-center" v-show="state === 0 ">--End--</p>
<div class="empty-tip" v-show="empty">
<div class="empty-tip" v-show="state === -1">
<i class="icon icon-search"></i>
<p class="empty-tip-cn">未找到相关商品</p>
<p class="empty-tip-en">Did not find the relevant goods</p>
... ... @@ -43,7 +43,7 @@
// 数据
data: Array,
empty: Boolean
state: [Number, Object] // -1: 无数据 0: 全部加载完 1: 正在加载
},
computed: {
// 空列表: data.length === 0
... ...
... ... @@ -4,7 +4,7 @@
<i class="icon icon-filter" slot="right" @click="openFilter"></i>
</cheader>
<order :config="orderConfig" :val="order" v-if="enableOrder"></order>
<List :data="productList" :empty="empty"></List>
<List :data="productList" :state="listState"></List>
<Filter :config="filterConfig" v-ref:filter></Filter>
</div>
</template>
... ... @@ -53,6 +53,23 @@
computed: {
empty: function() {
return this.page !== 0 && !this.productList.length;
},
listState: function() {
let state = undefined; // 0: 全部加载完 1: 正在加载
if (!this.page) {
return;
}
if (!this.productList.length) {
return -1;
} else if (this.page === this.totalPage) {
return 0;
} else if (this.inSearching) {
return 1;
}
return state;
}
},
components: {
... ...
... ... @@ -3,7 +3,7 @@
<cheader title="新品抢先看">
<i class="icon icon-filter" slot="right" @click="openFilter"></i>
</cheader>
<List :data="productList" :empty="empty"></List>
<List :data="productList" :state="listState"></List>
<Filter :config="filterConfig" action="/product/list.json" v-ref:filter></Filter>
</div>
</template>
... ... @@ -46,8 +46,22 @@
};
},
computed: {
empty: function() {
return this.page !== 0 && !this.productList.length;
listState: function() {
let state = undefined; // 0: 全部加载完 1: 正在加载
if (!this.page) {
return;
}
if (!this.productList.length) {
return -1;
} else if (this.page === this.totalPage) {
return 0;
} else if (this.inSearching) {
return 1;
}
return state;
}
},
components: {
... ...
... ... @@ -2,7 +2,7 @@
<div>
<Order :config="orderConfig" :val="order" v-if="enableOrder">
</Order>
<List :data="productList" :empty="empty"></List>
<List :data="productList" :state="listState"></List>
</div>
</template>
<script>
... ... @@ -45,9 +45,22 @@
};
},
computed: {
// 无数据
empty: function() {
return this.page !== 0 && !this.productList.length;
listState: function() {
let state = undefined; // 0: 全部加载完 1: 正在加载
if (!this.page) {
return;
}
if (!this.productList.length) {
return -1;
} else if (this.page === this.totalPage) {
return 0;
} else if (this.inSearching) {
return 1;
}
return state;
}
},
components: {
... ...
... ... @@ -3,7 +3,7 @@
<shop-top :shop-info="shopInfo"></shop-top>
<div :class='{"shop-goods-top": !shopInfo.isBlkShop}'>
<goods-list :data="productList" :empty="empty"></goods-list>
<goods-list :data="productList" :state="listState"></goods-list>
</div>
<filter :config="filterConfig" v-ref:filter></filter>
</template>
... ... @@ -57,6 +57,23 @@
computed: {
empty: function() {
return this.page !== 0 && !this.productList.length;
},
listState: function() {
let state = undefined; // 0: 全部加载完 1: 正在加载
if (!this.page) {
return;
}
if (!this.productList.length) {
return -1;
} else if (this.page === this.totalPage) {
return 0;
} else if (this.inSearching) {
return 1;
}
return state;
}
},
watch: {
... ...