... The actual project usage of the extension operator

Source: Internet
Author: User

v-show= "maindata.length > 0" style= "Display:none" >
<div class= "Main-common-div" >
<div class= "Common-part-div div-part-3" >
Credit to the borrower.
</div>
<div class= "Common-part-div div-part-7" >
Business Number
</div>
</div>
</div>
<div v-infinite-scroll= "Loadmore"
infinite-scroll-disabled= "Loading"
infinite-scroll-immediate-check= "false"
infinite-scroll-distance= "5" >
<div class= "Common-div" v-for= "item in Maindata" >
<div class= "main-common-div" @click = "Gourl (item)" >
<div class= "Common-part-div div-part-3" >
{{Item.truename}}
</div>
<div class= "Common-part-div div-part-7" >
{{ITEM.CREDITSN}}
</div>

</div>
</div>
</div>


v-show= "typeof (Maindata) = = ' object ' && maindata.length = = 0" style= "display:none" ></ Loadingnot>
Data () {
return {
Maindata: ",     //Data storage Place
}
}
This way, when the definition data is "at the beginning, it will not show that when the Loadingnot,ajax gets the data , the Maindata cannot use the push method if it is a drop-down refresh.
Then you need to use the extension operator ...
this. $ajax ({
URL: "/api/app/credit/page?type=17",
Data: {
Current:this.current,
Size:this.size
},
Loading:2
}, res = = {
if (Res.code = = 1) {
This.maindata = [... this.maindata, ... res.records];
this.current++;
This.loading = false;
if (This.size * (this.current-1) > This.total) {
This.isend = true;
this. $alert ("All Data Loaded");
}
This.total = Res.total;
}
});
For example [... ',... [123]] [123] This will make it possible to successfully move the following data similar to the push method.


... The actual project usage of the extension operator

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.