Authored by htoooth

latest view

@@ -487,7 +487,7 @@ function _getSortNavAsync(smallSortId, gender) { @@ -487,7 +487,7 @@ function _getSortNavAsync(smallSortId, gender) {
487 487
488 // 保存在 gids 和 skns ,最近流览功能 488 // 保存在 gids 和 skns ,最近流览功能
489 const saveRecentGoodInCookies = (oldSkns, res, addSkns) => { 489 const saveRecentGoodInCookies = (oldSkns, res, addSkns) => {
490 - oldSkns = oldSkns || []; 490 + oldSkns = oldSkns.split(',') || [];
491 491
492 _.remove(oldSkns, addSkns); 492 _.remove(oldSkns, addSkns);
493 493
1 -<script id="latest-walk-tpl" type="text/html">  
2 - \{{# latestWalk}}  
3 - <div class="good">  
4 - <a href="\{{href}}" target="_blank">  
5 - <img class="lazy" data-original="\{{img}}">  
6 - </a>  
7 - <a class="name" href="\{{href}}" target="_blank">\{{name}}</a>  
8 - <p class="price">  
9 - <span class="market-price">\{{marketPrice}}</span>  
10 - <span class="sale-price">\{{salePrice}}</span>  
11 - </p>  
12 - </div>  
13 - \{{/ latestWalk}}  
14 -</script>  
@@ -11,4 +11,9 @@ @@ -11,4 +11,9 @@
11 </p> 11 </p>
12 </div> 12 </div>
13 \{{/ latestWalk}} 13 \{{/ latestWalk}}
14 -</script>  
  14 +</script>
  15 +<div class="lazy-load-object">
  16 + <textarea class="datalazyload" style="visibility: hidden;">
  17 + <script>fetchLatestWalk();</script>
  18 + </textarea>
  19 +</div>
@@ -502,8 +502,7 @@ bindEvent.add(function() { @@ -502,8 +502,7 @@ bindEvent.add(function() {
502 // yas 502 // yas
503 require('../common'); 503 require('../common');
504 504
505 -// 最近浏览  
506 -require('./detail/latest-walk'); 505 +require('./detail/latest-walk'); // 最近浏览
507 506
508 // 商品详情/材质洗涤切换 507 // 商品详情/材质洗涤切换
509 $('.description-material').on('click', '.title', function() { 508 $('.description-material').on('click', '.title', function() {
@@ -10,7 +10,12 @@ var lazyLoad = require('yoho-jquery-lazyload'); @@ -10,7 +10,12 @@ var lazyLoad = require('yoho-jquery-lazyload');
10 10
11 var $latestWalkCount = $('#latest-walk-count'); 11 var $latestWalkCount = $('#latest-walk-count');
12 12
13 -(function() { 13 +var dataLazyLoad = require('../../plugins/lazy-load')(document);
  14 +
  15 +// 数据懒加载
  16 +dataLazyLoad.init({cls: 'datalazyload', threshold: -50});
  17 +
  18 +function fetchLatestWalk() {
14 var tpl; 19 var tpl;
15 20
16 if ($latestWalkCount.length === 0) { 21 if ($latestWalkCount.length === 0) {
@@ -59,4 +64,6 @@ var $latestWalkCount = $('#latest-walk-count'); @@ -59,4 +64,6 @@ var $latestWalkCount = $('#latest-walk-count');
59 } 64 }
60 } 65 }
61 }); 66 });
62 -}()); 67 +}
  68 +
  69 +window.fetchLatestWalk = fetchLatestWalk;