提交 625627ea 编写于 作者: 芊里

添加无数据缺省图

上级 f818161d
...@@ -21,7 +21,7 @@ ...@@ -21,7 +21,7 @@
<!-- 页面分类标题 --> <!-- 页面分类标题 -->
<uni-section style="margin:0;" v-if="searchText" :title="listTitle" type="line"></uni-section> <uni-section style="margin:0;" v-if="searchText" :title="listTitle" type="line"></uni-section>
<unicloud-db ref="udb" v-slot:default="{data, loading, error, options}" :options="formData" <unicloud-db ref="udb" v-slot:default="{data, loading, error, options}" :options="formData"
:collection="collection" :field="field" :where="where" @load="load"> :collection="collection" :field="field" :where="where" @load="load($event);isLoading = false;" @error="isLoading = false">
<text v-if="error" class="list-info">{{error.message}}</text> <text v-if="error" class="list-info">{{error.message}}</text>
<!-- 基于 uni-list 的页面布局 --> <!-- 基于 uni-list 的页面布局 -->
<uni-list :class="{ 'uni-list--waterfall': options.waterfall }"> <uni-list :class="{ 'uni-list--waterfall': options.waterfall }">
...@@ -54,7 +54,7 @@ ...@@ -54,7 +54,7 @@
</uni-list> </uni-list>
<!-- 通过 loadMore 组件实现上拉加载效果,如需自定义显示内容,可参考:https://ext.dcloud.net.cn/plugin?id=29 --> <!-- 通过 loadMore 组件实现上拉加载效果,如需自定义显示内容,可参考:https://ext.dcloud.net.cn/plugin?id=29 -->
<uni-load-more v-if="!error && (loading || options.status === 'noMore') " :status="options.status" /> <uni-load-more v-if="!error && (loading || options.status === 'noMore') " :status="options.status" />
<uni-nodata v-if="data.length == 0" @retry="refresh"></uni-nodata> <uni-nodata v-if="data.length == 0" :isLoading="isLoading" @retry="refresh"></uni-nodata>
</unicloud-db> </unicloud-db>
</view> </view>
</view> </view>
...@@ -88,7 +88,8 @@ ...@@ -88,7 +88,8 @@
collection: 'opendb-news-articles,uni-id-users', collection: 'opendb-news-articles,uni-id-users',
// 查询字段,多个字段用 , 分割 // 查询字段,多个字段用 , 分割
field: 'author{username, _id}, user_id,_id,avatar,title,excerpt,last_modify_date, comment_count, like_count', field: 'author{username, _id}, user_id,_id,avatar,title,excerpt,last_modify_date, comment_count, like_count',
tipShow: false // 是否显示顶部提示框 tipShow: false ,// 是否显示顶部提示框
isLoading:true
}; };
}, },
/** /**
......
<template> <template>
<view class="container"> <view class="container">
<unicloud-db ref="udb" v-slot:default="{data, pagination, loading, hasMore, error}" collection="opendb-feedback" <unicloud-db ref="udb" v-slot:default="{data, pagination, loading, hasMore, error}" collection="opendb-feedback"
field="content, title" where="is_reply == false"> field="content, title" where="is_reply == false" @load="isLoading == false" @error="isLoading == false">
<view v-if="data && data.length"> <view v-if="data && data.length">
<uni-collapse :accordion="true"> <uni-collapse :accordion="true">
<uni-collapse-item v-for="(item, index) in data" :key="index" :title="item.title" :show-animation="true"> <uni-collapse-item v-for="(item, index) in data" :key="index" :title="item.title" :show-animation="true">
...@@ -9,7 +9,7 @@ ...@@ -9,7 +9,7 @@
</uni-collapse-item> </uni-collapse-item>
</uni-collapse> </uni-collapse>
</view> </view>
<uni-nodata v-else @retry="refreshData"></uni-nodata> <uni-nodata v-else :isLoading="isLoading" @retry="refreshData"></uni-nodata>
</unicloud-db> </unicloud-db>
<uni-fab ref="fab" horizontal="right" vertical="bottom" :pop-menu="false" @fabClick="fabClick" /> <uni-fab ref="fab" horizontal="right" vertical="bottom" :pop-menu="false" @fabClick="fabClick" />
</view> </view>
...@@ -19,7 +19,7 @@ ...@@ -19,7 +19,7 @@
export default { export default {
data() { data() {
return { return {
isLoading:true,
} }
}, },
methods: { methods: {
......
...@@ -5,9 +5,14 @@ ...@@ -5,9 +5,14 @@
<text class="title">{{textTypes[networkType]}}</text> <text class="title">{{textTypes[networkType]}}</text>
</view> </view>
<view class="icon-view"> <view class="icon-view">
<image src="/uni_modules/uni-nodata/static/nodata.png" class="icon-image"></image> <!-- 无数据 icon -->
<image v-if="!isLoading" src="/uni_modules/uni-nodata/static/nodata.png" class="icon-image"></image>
<!-- 加载中 icon -->
<image v-else src="/uni_modules/uni-nodata/static/loading.png" class="icon-loading"></image>
<text class="title">{{isLoading ? '加载中...' : ''}}</text>
</view> </view>
<view class="opera-view"> <view class="opera-view" v-if="!isLoading">
<view class="btn btn-default" v-if="networkType!='none'" @click="retry"> <view class="btn btn-default" v-if="networkType!='none'" @click="retry">
<text class="btn-text">重试</text> <text class="btn-text">重试</text>
</view> </view>
...@@ -21,7 +26,13 @@ ...@@ -21,7 +26,13 @@
<script> <script>
export default { export default {
name: 'uni-nodata', name: 'uni-nodata',
props:{
isLoading:{
type:Boolean,
default:false
}
},
data() { data() {
return { return {
textTypes: { textTypes: {
...@@ -207,6 +218,11 @@ ...@@ -207,6 +218,11 @@
border-color: #DD524D; border-color: #DD524D;
} }
.icon-loading{
width: 500rpx;
height: 300rpx;
}
.icon-image{ .icon-image{
width: 640rpx; width: 640rpx;
height: 640rpx; height: 640rpx;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册