{"id":1158,"date":"2023-06-24T14:26:10","date_gmt":"2023-06-24T06:26:10","guid":{"rendered":"https:\/\/log.tanxiaodian.com\/?p=1158"},"modified":"2023-06-24T14:26:11","modified_gmt":"2023-06-24T06:26:11","slug":"%e6%89%8b%e6%9c%ba%e7%ab%af%e6%bb%91%e5%8a%a8%e5%88%86%e9%a1%b5%e5%b9%b6%e9%98%b2%e6%8a%96%e7%9a%84%e4%bb%a3%e7%a0%81","status":"publish","type":"post","link":"https:\/\/log.tanxiaodian.com\/?p=1158","title":{"rendered":"\u624b\u673a\u7aef\u6ed1\u52a8\u5206\u9875\u5e76\u9632\u6296\u7684\u4ee3\u7801"},"content":{"rendered":"\n<pre class=\"wp-block-preformatted\">var <strong><em>isLoading <\/em><\/strong>= false;<br>var <strong><em>isEnd <\/em><\/strong>= false;<br>var <strong><em>curentPage <\/em><\/strong>= 2;<br><br><br>var <strong><em>h5Js <\/em><\/strong>= function(){<br>   return {<br>      load: function () {<br>         if(<strong><em>isLoading<\/em><\/strong>) {<br>            return;<br>         }<br>         $.ajax({<br>            type:\"GET\",<br>            url:<strong><em>ApiUrl <\/em><\/strong>+ \"\/index.php?act=index&amp;op=indexpg\",<br>            dataType:\"json\",<br>            data:{curpage : <strong><em>curentPage<\/em><\/strong>},<br>            contentType:\"application\/json\",<br>            beforeSend:function(){<br>               <strong><em>isLoading <\/em><\/strong>= true;<br>               $(\"#loading\").html(\"\u52a0\u8f7d\u4e2d...\");<br><br>            },<br>            success:function (resp){<br>               if(resp.code == 200){<br>                  var data = resp.datas;<br>                  if(data.isLastPage == 1){<br>                     <strong><em>isEnd <\/em><\/strong>= true;<br>                     $(\"#loading\").text(\" -- \u5230\u5e95\u4e86 --\");<br>                  } else {<br>                     <strong><em>curentPage<\/em><\/strong>++;<br>                     $(\"#loading\").html(\"\u4e0a\u6ed1\u67e5\u770b\u66f4\u591a\");<br>                  }<br>                  var html_goods = '';<br>                  var goods_list = data.goods_list;<br>                  $.each(goods_list, function (i, item){<br>                     let htmlitem = '&lt;a class=\"goods-itemg\" href=\"tmpl\/product_detail.html?goods_id='+item.goods_id+'\"&gt;' +<br>                           '&lt;div class=\"googs-item-l\"&gt;' +<br>                           '&lt;img src=\"'+item.goods_image_url +'\"&gt;'+<br>                           '&lt;\/div&gt;\\n' +<br>                           '&lt;div class=\"goods-item-r\"&gt;\\n' +<br>                           '&lt;div class=\"goods-i-title\"&gt;'+item.goods_name+'&lt;\/div&gt;\\n' +<br>                           '&lt;div class=\"goods-i-price\"&gt;\\n' +<br>                           '&lt;div class=\"goods-i-p-l\"&gt;\u539f\u4ef7\uffe5'+item.goods_marketprice+'&lt;\/div&gt;\\n' +<br>                           '&lt;div class=\"goods-i-p-r\"&gt;1\u4eba\u8d2d\u4e70&lt;\/div&gt;\\n' +<br>                           '&lt;\/div&gt;\\n' +<br>                           '&lt;div class=\"goods-i-buy\"&gt;\\n' +<br>                           '&lt;div class=\"goods-i-buy-l\"&gt;\uffe5'+item.goods_price+'&lt;\/div&gt;\\n' +<br>                           '&lt;div class=\"goods-i-buy-r\"&gt;\u8d2d\u4e70&lt;\/div&gt;\\n' +<br>                           '&lt;\/div&gt;\\n' +<br>                           '&lt;\/div&gt;\\n' +<br>                           '&lt;\/a&gt;';<br>                     html_goods += htmlitem<br>                  });<br>                  $(\"#goods-list\").append(html_goods);<br>               }else{<br>                  \/\/error<br>               }<br>            },<br>            error: function(XMLHttpRequest, textStatus, errorThrown){<br>               <strong><em>isLoading <\/em><\/strong>= false;<br>               $(\"#loading\").html(\"\u52a0\u8f7d\u5931\u8d25...\");<br>            },<br>            complate:function(){<br>               <strong><em>isLoading <\/em><\/strong>= false;<br>            }<br>         });<br>      }<br>   }<br>}();<br><br><br>\/\/\u6267\u884c\u9891\u7387\u592a\u9ad8 \u6bd4\u5982\u9700\u8981\u52a8\u4e00\u4e0b\u5c31\u8981\u5224\u65ad\u6267\u884c\u67d0\u52a8\u753b~~<br>function scrollHandle(){<br>   var scrollTop = <strong><em>document<\/em><\/strong>.body.scrollTop + <strong><em>document<\/em><\/strong>.documentElement.scrollTop;<br>   var clientHeight = <strong><em>document<\/em><\/strong>.documentElement.clientHeight;<br>   if($(\"body\").height() - scrollTop - clientHeight &lt;= 0) {<br>      <strong><em>h5Js<\/em><\/strong>.load();<br>   }<br>}<br><br>function debounce(fn, delay){<br>   var timer = null;<br>   return function(){<br>      if(timer){<br>         clearTimeout(timer)<br>      }<br>      timer = setTimeout(fn, delay)<br>   }<br>}<br><br><strong><em>window<\/em><\/strong>.onscroll = debounce(scrollHandle, 200)<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>var isLoading = false;var&#8230;<\/p>\n<div class=\"more-link-wrapper\"><a class=\"more-link\" href=\"https:\/\/log.tanxiaodian.com\/?p=1158\">Continue reading<span class=\"screen-reader-text\">\u624b\u673a\u7aef\u6ed1\u52a8\u5206\u9875\u5e76\u9632\u6296\u7684\u4ee3\u7801<\/span><\/a><\/div>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":[],"categories":[7],"tags":[],"_links":{"self":[{"href":"https:\/\/log.tanxiaodian.com\/index.php?rest_route=\/wp\/v2\/posts\/1158"}],"collection":[{"href":"https:\/\/log.tanxiaodian.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/log.tanxiaodian.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/log.tanxiaodian.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/log.tanxiaodian.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1158"}],"version-history":[{"count":1,"href":"https:\/\/log.tanxiaodian.com\/index.php?rest_route=\/wp\/v2\/posts\/1158\/revisions"}],"predecessor-version":[{"id":1159,"href":"https:\/\/log.tanxiaodian.com\/index.php?rest_route=\/wp\/v2\/posts\/1158\/revisions\/1159"}],"wp:attachment":[{"href":"https:\/\/log.tanxiaodian.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1158"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/log.tanxiaodian.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1158"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/log.tanxiaodian.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1158"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}