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

添加无数据缺省图

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