ThinkChat2.0新版上线,更智能更精彩,支持会话、画图、阅读、搜索等,送10W Token,即刻开启你的AI之旅 广告
| 下载地址 | | --- | | https://ext.dcloud.net.cn/plugin?id=4489 | * 模板调用 ~~~ <template> <view> <t-refresh ref="refresh" @refresh="refresh" @loadMore="loadMore" :loadingType="loadingType"> <template slot="content"> <view class="refresh-item" v-for="(item,index) in number" :key="index"> {{index}} </view> </template> </t-refresh> <t-toast ref="toast"></t-toast> </view> </template> ~~~ * script调用 ~~~ import tRefresh from "@/components/t-refresh/t-refresh.vue" import tToast from "@/components/t-toast/t-toast.vue" export default { components:{tRefresh,tToast}, data() { let arr = {}; arr.loadingType = 0; arr.number = 20; return arr; }, onLoad() { }, methods: { // 加载更多 loadMore: async function() { //loadingType: 0.数据未加载完 1.数据全部加载完了 2.数据加载中 if(this.loadingType==0){ this.loadingType=2 //模拟数据请求 setTimeout(()=>{ this.number=30 this.loadingType=1 },1000) } }, //刷新 refresh(e){ //模拟数据请求 setTimeout(()=>{ this.$refs.refresh.endRefresh() this.number=20 this.loadingType=0 this.$refs.toast.show('success','更新成功') },1000) }, } } ~~~ * style调用 ~~~ .refresh-item{ height:80upx; line-height: 80upx; text-align: center; border-bottom: 1upx solid #F4F4F4; } ~~~