mint-ui loadmore pull-up loading and pull-down refresh conflict handling method

php中世界最好的语言
Release: 2018-04-14 16:47:33
Original
4300 people have browsed it

This time I will bring you the conflict handling method between mint-ui loadmore pull-up loading and pull-down refresh. What are theprecautionsfor handling the conflict between mint-ui loadmore pull-up loading and pull-down refresh? The following is a practical case, let’s take a look.

Problems encountered:

This page is a dual-tab linkage. All four parts require pull-up loading and pull-down refresh functions. The loadmore plug-in of mint-ui is used. After adding pull-up loading respectively, only the last one hasthis.$refs. loadmore.onTopLoaded();andthis.$refs.loadmore.onBottomLoaded();

Valid, the other three are invalid. These two sentences mean thatqueryneeds to be called once for relocation

Analysis of the reason:

First of all, these four modules are used     

 
  • {{item.a}}

    {{item.b}}

    ¥{{item.c}}

Copy after login

top-method, bottom-method, and bottom-all-loaded are given differenteventnames respectively. The first two events represent pull-down and pull-up respectively. If the third one is true, bottomMethod will not be loaded again. Triggered, generally when entering the page we default to false

When calling theinterface, the judgment of canceling the loading is made after the success. Here you can give the interface method a type value. If the type is top1, it proves that the ongoing pull-down refresh executionthis.$refs.loadmore1 .onTopLoaded();, the same applies to pull-up loading, and the other three modules

if(type=='top1'){ this.$refs.loadmore1.onTopLoaded(); }else if(type=='bottom1'){ this.$refs.loadmore1.onBottomLoaded(); }
Copy after login

When you get here, the problem described at the beginning will appear,

Solution

I made a lot of attempts at the beginning, such as using v-if to hide the other three modules when one module is displayed, but different problems always occurred. Later, the parameters after ref in ref="loadmore" were used in four modules. For example, the distinction is loadmore1, loadmore2..., here is how I understand it, ref The function here is to specify anindexID for the subcomponent, which is similar to the id of the dom element. The id name cannot be the same, so we change the ref to a different parameter and the problem is solved,

Attached is the Vue official website linkhttps://vuejs.org/

  mint-ui:https://mint-ui.github.io/docs/#/en2/loadmore

PS: Mint-ui loadmore component attention issues

loadTop(){ this.$store.dispatch('getNewsList',{channelId:this.id,page:0,size:this.size}); this.$refs.loadmore.onTopLoaded(); },
Copy after login

For example, when doing pull-down refresh, remember to add

this.$refs.loadmore.onTopLoaded();
Copy after login

in the pull-down refresh function. This line of code, otherwise the loading will always be displayed after the drop-down loading, and the loading will not be completed.

I believe you have mastered the method after reading the case in this article. For more exciting information, please pay attention to other related articles on the php Chinese website!

Recommended reading:



The above is the detailed content of mint-ui loadmore pull-up loading and pull-down refresh conflict handling method. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!