|
@@ -31,10 +31,6 @@
|
|
|
},
|
|
|
created: function () {
|
|
|
this.getDatas();
|
|
|
- window.addEventListener('scroll',function(){
|
|
|
- this.scrollTop = window.scrollY;
|
|
|
- this.documentHeight = document.body.scrollHeight;
|
|
|
- })
|
|
|
},
|
|
|
methods: {
|
|
|
getDatas()
|
|
@@ -43,6 +39,11 @@
|
|
|
let _self = this;
|
|
|
this.$http.jsonp(this.datasLink).then(function (res) {
|
|
|
let body = JSON.parse(res.bodyText);
|
|
|
+ _self.datas = body.datas;
|
|
|
+ _self.hasmore = body.datas['mobile_page'].hasmore;
|
|
|
+ if(body.datas['mobile_page'].hasmore) {
|
|
|
+ this.scrollBottomEvent(this.datasLink,this.loadMore);
|
|
|
+ }
|
|
|
_self.special_list = body.datas['special_list'];
|
|
|
_self.proxy = new Proxy(body.datas);
|
|
|
_self.proxy.setTag("SPECIAL_ID", this.special_id);
|
|
@@ -58,11 +59,28 @@
|
|
|
});
|
|
|
this.$store.commit('updateLoadingStatus', {isLoading: false});
|
|
|
})
|
|
|
+ },
|
|
|
+ scrollBottomEvent(link,callback){
|
|
|
+ //滑动到底部
|
|
|
+ window.addEventListener('scroll',function(){
|
|
|
+ this.scrollTop = document.body.scrollTop;
|
|
|
+ this.documentHeight = document.body.scrollHeight;
|
|
|
+ this.windowHeight = window.screen.height*2;
|
|
|
+ if(this.scrollTop + this.windowHeight >= this.documentHeight){
|
|
|
+ callback(link);
|
|
|
+ }
|
|
|
+ });
|
|
|
+ },
|
|
|
+ loadMore(link){
|
|
|
+ this.$http.jsonp(link+'&curpage=3').then(function(res){
|
|
|
+ console.log(res);
|
|
|
+ })
|
|
|
}
|
|
|
},
|
|
|
data()
|
|
|
{
|
|
|
return {
|
|
|
+ datas:{},
|
|
|
special_list: [],
|
|
|
proxy: {},
|
|
|
history: {
|
|
@@ -71,7 +89,8 @@
|
|
|
hasmore:false,
|
|
|
page_total:0,
|
|
|
scrollTop:0,
|
|
|
- documentHeight:0
|
|
|
+ documentHeight:0,
|
|
|
+ windowHeight:0
|
|
|
}
|
|
|
}
|
|
|
,
|
|
@@ -84,20 +103,46 @@
|
|
|
let loadMore = createElement(LoadMore, {
|
|
|
props: {
|
|
|
showLoading: false,
|
|
|
- tip: "暂无数据"
|
|
|
+ tip: "暂无数据",
|
|
|
+ backgroundColor:"#f9f9f9"
|
|
|
}
|
|
|
}, []);
|
|
|
- return createElement('div', {}, [loadMore]);
|
|
|
+ return createElement('div', {
|
|
|
+ style:{
|
|
|
+ backgroundColor:"#f9f9f9"
|
|
|
+ }
|
|
|
+ }, [loadMore]);
|
|
|
}
|
|
|
-
|
|
|
-
|
|
|
- _self.special_list.map(function (special) {
|
|
|
- let comp = BlockUtil.createBlockComp(createElement, special, _self.proxy);
|
|
|
- if (comp) {
|
|
|
- specialArray.push(comp);
|
|
|
+ else {
|
|
|
+ let loadMore = createElement(LoadMore, {
|
|
|
+ props: {
|
|
|
+ tip: "正在为您全力加载",
|
|
|
+ backgroundColor:"red"
|
|
|
+ },
|
|
|
+ style:{
|
|
|
+ margin:'0 auto'
|
|
|
+ }
|
|
|
+ });
|
|
|
+ let loadMoreBox = createElement('div',{
|
|
|
+ style:{
|
|
|
+ backgroundColor:"#f9f9f9"
|
|
|
+ }
|
|
|
+ },[loadMore]);
|
|
|
+ _self.special_list.map(function (special) {
|
|
|
+ let comp = BlockUtil.createBlockComp(createElement, special, _self.proxy);
|
|
|
+ if (comp) {
|
|
|
+ specialArray.push(comp);
|
|
|
+ }
|
|
|
+ });
|
|
|
+ if(this.hasmore) {
|
|
|
+ specialArray.push(loadMoreBox);
|
|
|
}
|
|
|
- });
|
|
|
- return createElement('div', {}, specialArray);
|
|
|
+ return createElement('div', {
|
|
|
+ style:{
|
|
|
+ backgroundColor:"#f9f9f9"
|
|
|
+ }
|
|
|
+ }, specialArray);
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
</script>
|
|
@@ -109,4 +154,8 @@
|
|
|
height: auto;
|
|
|
display: block;
|
|
|
}
|
|
|
+ .weui-loading {
|
|
|
+ min-width: 40px;
|
|
|
+ min-height: 40px;
|
|
|
+ }
|
|
|
</style>
|