提交 2a8f6c3f 编写于 作者: H hdx

chore(long-list): 移除旧版本 loading 的临时方案

上级 672b528f
...@@ -2,10 +2,10 @@ ...@@ -2,10 +2,10 @@
<list-view ref="listView" class="list" :rebound="false" :scroll-y="true" :custom-nested-scroll="true" <list-view ref="listView" class="list" :rebound="false" :scroll-y="true" :custom-nested-scroll="true"
@scrolltolower="loadData(null)"> @scrolltolower="loadData(null)">
<list-item class="list-item" v-for="(item, _) in dataList" :key="item.plugin_id"> <list-item class="list-item" v-for="(item, _) in dataList" :key="item.plugin_id">
<view class="list-item-icon" v-if="item.plugin_id!=-1"> <view class="list-item-icon">
<image class="list-item-icon-image" :src="item.plugin_img_link"></image> <image class="list-item-icon-image" :src="item.plugin_img_link"></image>
</view> </view>
<view class="list-item-fill" v-if="item.plugin_id!=-1"> <view class="list-item-fill">
<view class="flex-row"> <view class="flex-row">
<text class="title">{{item.plugin_name}}</text> <text class="title">{{item.plugin_name}}</text>
</view> </view>
...@@ -22,8 +22,9 @@ ...@@ -22,8 +22,9 @@
<text class="author">{{item.author_name}}</text> <text class="author">{{item.author_name}}</text>
</view> </view>
</view> </view>
<!-- TODO 暂时这样写才能保证 loading 在 list 底部 --> </list-item>
<view v-if="item.plugin_id==-1" class="loading"> <list-item>
<view class="loading">
<text class="loading-text">{{loadingText}}</text> <text class="loading-text">{{loadingText}}</text>
</view> </view>
</list-item> </list-item>
...@@ -81,35 +82,17 @@ ...@@ -81,35 +82,17 @@
} else { } else {
return "" return ""
} }
}, }
}, },
created() { created() {
this.insertLoadingData()
if (this.preload) { if (this.preload) {
this.loadData(null) this.loadData(null)
} }
}, },
methods: { methods: {
// TODO 目前 list-item 不支持注释节点
// 暂时在数据末尾插入一条空数据用于显示 loading
insertLoadingData() {
const loadingData = {
plugin_id: -1,
plugin_img_link: '',
plugin_name: '',
plugin_intro: '',
score: 0,
tags: [],
update_date: '',
author_name: '',
} as ListItem
this.dataList.push(loadingData)
},
refreshData(loadComplete : (() => void) | null) { refreshData(loadComplete : (() => void) | null) {
this.dataList.length = 0 this.dataList.length = 0
this.$currentPage = 1 this.$currentPage = 1
this.insertLoadingData()
this.loadData(loadComplete) this.loadData(loadComplete)
}, },
loadData(loadComplete : (() => void) | null) { loadData(loadComplete : (() => void) | null) {
...@@ -131,9 +114,7 @@ ...@@ -131,9 +114,7 @@
return return
} }
// TODO this.dataList.push(...responseData.data)
this.dataList.splice(this.dataList.length - 1, 0, ...responseData.data)
// this.dataList.push(...responseData.data)
if (responseData.data.length == 0) { if (responseData.data.length == 0) {
this.isEnded = true this.isEnded = true
...@@ -254,20 +235,12 @@ ...@@ -254,20 +235,12 @@
} }
.loading { .loading {
/* position: absolute; padding: 20px;
left: 0;
top: 0;
right: 0;
bottom: 0; */
flex:1;
margin: -10px;
background-color: #f8f8f8; background-color: #f8f8f8;
margin-bottom: 1px;
justify-content: center; justify-content: center;
} }
.loading-text { .loading-text {
padding: 20px;
text-align: center; text-align: center;
} }
</style> </style>
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册