...
|
...
|
@@ -3,16 +3,16 @@ |
|
|
<ul class="cardlist card-large clearfix">
|
|
|
<li class="card" v-for="(item, index) in data" :key="item.product_skn" @click="clickProduct(item, index)">
|
|
|
<div class="card-pic">
|
|
|
<a v-good-href="item">
|
|
|
<a v-good-href="item" :class="hrefClass">
|
|
|
<img v-img-src="{src: item.default_images, width: 330, height: 440}" :alt="item.product_name">
|
|
|
</a>
|
|
|
</div>
|
|
|
<div class="card-bd">
|
|
|
<h2 class="card-label">
|
|
|
<a v-good-href="item" class="line-clamp-1">{{item.product_name}}</a>
|
|
|
<a v-good-href="item" class="line-clamp-1" :class="hrefClass">{{item.product_name}}</a>
|
|
|
</h2>
|
|
|
<h2 class="card-label-desc" v-if="item.product_name1">
|
|
|
<a v-good-href="item" class="line-clamp-1">{{item.product_name}}</a>
|
|
|
<a v-good-href="item" class="line-clamp-1" :class="hrefClass">{{item.product_name}}</a>
|
|
|
</h2>
|
|
|
<span class="good-price" :class="{'sale-price': item.market_price}">¥{{item.sales_price | toFixed}}</span>
|
|
|
<span class="good-price" :class="{'old-price': item.market_price}" v-if="item.market_price">¥{{item.market_price | toFixed}}</span>
|
...
|
...
|
@@ -30,16 +30,20 @@ |
|
|
</div>
|
|
|
</template>
|
|
|
<script>
|
|
|
import Vue from 'vue';
|
|
|
import lazyload from 'vue-lazyload';
|
|
|
import infinitScroll from 'vue-infinite-scroll';
|
|
|
import bus from 'common/vue-bus';
|
|
|
|
|
|
Vue.use(lazyload, { preLoad: 3 });
|
|
|
Vue.use(infinitScroll);
|
|
|
|
|
|
|
|
|
export default {
|
|
|
import Vue from 'vue';
|
|
|
import lazyload from 'vue-lazyload';
|
|
|
import infinitScroll from 'vue-infinite-scroll';
|
|
|
import bus from 'common/vue-bus';
|
|
|
|
|
|
Vue.use(lazyload, { preLoad: 3 });
|
|
|
Vue.use(infinitScroll);
|
|
|
|
|
|
export default {
|
|
|
data() {
|
|
|
return {
|
|
|
hrefClass: {}
|
|
|
};
|
|
|
},
|
|
|
props: {
|
|
|
/* 开启滚动加载 */
|
|
|
disableFetch: Boolean,
|
...
|
...
|
@@ -54,33 +58,72 @@ |
|
|
return !this.data.length;
|
|
|
}
|
|
|
},
|
|
|
mounted() {
|
|
|
const $scrollEl = this.getScrollEventTarget(this.$el);
|
|
|
|
|
|
$scrollEl.addEventListener('scroll', this.throttle(this.scrollEnd, 200));
|
|
|
},
|
|
|
methods: {
|
|
|
fetch: function() {
|
|
|
bus.$emit('list.paging');
|
|
|
},
|
|
|
clickProduct(item, index) {
|
|
|
this.$emit('click-product', item, index);
|
|
|
},
|
|
|
scrollEnd() {
|
|
|
this.hrefClass = {};
|
|
|
},
|
|
|
getScrollEventTarget(element) {
|
|
|
let getComputedStyle = document.defaultView.getComputedStyle;
|
|
|
let currentNode = element;
|
|
|
|
|
|
while (currentNode && currentNode.tagName !== 'HTML' && currentNode.tagName !== 'BODY' && currentNode.nodeType === 1) {
|
|
|
let overflowY = getComputedStyle(currentNode).overflowY;
|
|
|
|
|
|
if (overflowY === 'scroll' || overflowY === 'auto') {
|
|
|
return currentNode;
|
|
|
}
|
|
|
currentNode = currentNode.parentNode;
|
|
|
}
|
|
|
return window;
|
|
|
},
|
|
|
throttle(fn, delay) {
|
|
|
let timer;
|
|
|
|
|
|
return () => {
|
|
|
if (timer) {
|
|
|
clearTimeout(timer);
|
|
|
timer = null;
|
|
|
}
|
|
|
this.hrefClass = {
|
|
|
'no-link': true
|
|
|
};
|
|
|
|
|
|
timer = setTimeout(() => {
|
|
|
fn();
|
|
|
}, delay);
|
|
|
};
|
|
|
}
|
|
|
}
|
|
|
};
|
|
|
|
|
|
</script>
|
|
|
<style>
|
|
|
@import "../../../scss/common/_color.css";
|
|
|
@import "../../../scss/common/_color.css";
|
|
|
|
|
|
.cardlist {
|
|
|
.cardlist {
|
|
|
list-style: none;
|
|
|
margin: 0;
|
|
|
padding: 0;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
.cardlist--loading {
|
|
|
.cardlist--loading {
|
|
|
font-size: 32px;
|
|
|
text-align: center;
|
|
|
padding: 16px 0;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
.card-large {
|
|
|
.card-large {
|
|
|
background-color: #fff;
|
|
|
|
|
|
.card {
|
...
|
...
|
@@ -130,9 +173,9 @@ |
|
|
color: #888;
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
.good-price {
|
|
|
.good-price {
|
|
|
color: #b0b0b0;
|
|
|
margin-right: 14px;
|
|
|
font-size: 24px;
|
...
|
...
|
@@ -150,9 +193,9 @@ |
|
|
&.sale-price {
|
|
|
color: #000;
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
.empty-tip {
|
|
|
.empty-tip {
|
|
|
margin-top: 200px;
|
|
|
color: #b0b0b0;
|
|
|
text-align: center;
|
...
|
...
|
@@ -162,15 +205,14 @@ |
|
|
font-size: 200px;
|
|
|
margin-bottom: 56px;
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
.empty-tip-cn {
|
|
|
.empty-tip-cn {
|
|
|
font-size: 34px;
|
|
|
margin-bottom: 30px;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
.empty-tip-en {
|
|
|
.empty-tip-en {
|
|
|
font-size: 20px;
|
|
|
}
|
|
|
|
|
|
}
|
|
|
</style> |
...
|
...
|
|