<unicloud-db ref="udbSum" v-slot:default="{data, loading, error, options}" collection="pay"
:where="`pay_date > ${selectDateStart} && pay_date < ${selectDateEnd} && openid == '${userInfo.openid}' && is_remove == 0`"
groupby="openid" group-field="sum(pay_num) as payMonthSum" loadtime="manual">
<view
class="month-pay main-margin-top mian-box-shadow bg-white main-border-radius flex justify-center align-center">
<text class="text14px">¥</text>
<text class="text30px text-bold" v-if="data.length > 0">{{data[0].payMonthSum / 1000}}</text>
<text class="text30px text-bold" v-else>0</text>
</view>
</unicloud-db>
<unicloud-db ref="udb" v-slot:default="{data, loading, error, options}" collection="pay"
:where="`pay_date > ${selectDateStart} && pay_date < ${selectDateEnd} && openid == '${userInfo.openid}' && is_remove == 0`"
groupby="pay_date" group-field="sum(pay_num) as payDaySum" orderby="pay_date desc" loadtime="manual">
<!-- 循环日期 -->
<view class="detail-list" v-for="(item,index) in data" :key="index" v-after>
<view class="detail-date flex align-center">
<uni-dateformat :date="item.pay_date" format="yyyy-MM-dd"></uni-dateformat>
<view class="body-padding">(¥{{item.payDaySum / 1000}})</view>
</view>
<view class="day-pay bg-white main-margin-top mian-box-shadow main-border-radius">
<unicloud-db v-slot:default="{data, loading, error, options}" v-if="data"
collection="pay, pay-type"
:where="`pay_date == ${item.pay_date} && openid == '${userInfo.openid}' && is_remove == 0`"
orderby="pay_date" loadtime="auto">
<!-- 每日消费详细 -->
<view class="day-pay-detail flex justify-between main-padding-top-down body-padding main-border-bottom"
v-for="(item1,index) in data" :key="index">
<text>{{item1.pay_type[0].type_name}}</text><text>¥{{item1.pay_num / 1000}}</text>
</view>
<!-- 每日消费明细结束 -->
</unicloud-db>
</view>
</view>
<!-- 循环日期结束 -->
</unicloud-db>
<script steup>
// 重新加载数据
function udbloadData() {
udb.value.loadData({
clear: true
})
udbSum.value.loadData({
clear: true
})
}
// 日期选择
function pickerDateChange(e) {
selectDate.value = e.detail.value
}
// 前往记一笔页面
function toNewView() {
uni.navigateTo({
url: '/pages/index/new/new'
})
}
onReady(() => {
udbloadData()
})
onShow(() => {
udbloadData()
})
</script>
- 发布:2024-01-11 11:32
- 更新:2024-01-15 14:04
- 阅读:125
产品分类: uniapp/小程序/微信
PC开发环境操作系统: Mac
PC开发环境操作系统版本号: 13.6
HBuilderX类型: 正式
HBuilderX版本号: 3.99
第三方开发者工具版本号: 最新
基础库版本号: 最新
项目创建方式: HBuilderX
示例代码:
操作步骤:
<unicloud-db ref="udbSum" v-slot:default="{data, loading, error, options}" collection="pay"
:where="`pay_date > ${selectDateStart} && pay_date < ${selectDateEnd} && openid == '${userInfo.openid}' && is_remove == 0`"
groupby="openid" group-field="sum(pay_num) as payMonthSum" loadtime="manual">
<view
class="month-pay main-margin-top mian-box-shadow bg-white main-border-radius flex justify-center align-center">
<text class="text14px">¥</text>
<text class="text30px text-bold" v-if="data.length > 0">{{data[0].payMonthSum / 1000}}</text>
<text class="text30px text-bold" v-else>0</text>
</view>
</unicloud-db>
<unicloud-db ref="udb" v-slot:default="{data, loading, error, options}" collection="pay"
:where="`pay_date > ${selectDateStart} && pay_date < ${selectDateEnd} && openid == '${userInfo.openid}' && is_remove == 0`"
groupby="pay_date" group-field="sum(pay_num) as payDaySum" orderby="pay_date desc" loadtime="manual">
<!-- 循环日期 -->
<view class="detail-list" v-for="(item,index) in data" :key="index" v-after>
<view class="detail-date flex align-center">
<uni-dateformat :date="item.pay_date" format="yyyy-MM-dd"></uni-dateformat>
<view class="body-padding">(¥{{item.payDaySum / 1000}})</view>
</view>
<view class="day-pay bg-white main-margin-top mian-box-shadow main-border-radius">
<unicloud-db v-slot:default="{data, loading, error, options}" v-if="data"
collection="pay, pay-type"
:where="`pay_date == ${item.pay_date} && openid == '${userInfo.openid}' && is_remove == 0`"
orderby="pay_date" loadtime="auto">
<!-- 每日消费详细 -->
<view class="day-pay-detail flex justify-between main-padding-top-down body-padding main-border-bottom"
v-for="(item1,index) in data" :key="index">
<text>{{item1.pay_type[0].type_name}}</text><text>¥{{item1.pay_num / 1000}}</text>
</view>
<!-- 每日消费明细结束 -->
</unicloud-db>
</view>
</view>
<!-- 循环日期结束 -->
</unicloud-db>
<script steup>
// 重新加载数据
function udbloadData() {
udb.value.loadData({
clear: true
})
udbSum.value.loadData({
clear: true
})
}
// 日期选择
function pickerDateChange(e) {
selectDate.value = e.detail.value
}
// 前往记一笔页面
function toNewView() {
uni.navigateTo({
url: '/pages/index/new/new'
})
}
onReady(() => {
udbloadData()
})
onShow(() => {
udbloadData()
})
</script>
<unicloud-db ref="udbSum" v-slot:default="{data, loading, error, options}" collection="pay"
:where="`pay_date > ${selectDateStart} && pay_date < ${selectDateEnd} && openid == '${userInfo.openid}' && is_remove == 0`"
groupby="openid" group-field="sum(pay_num) as payMonthSum" loadtime="manual">
<view
class="month-pay main-margin-top mian-box-shadow bg-white main-border-radius flex justify-center align-center">
<text class="text14px">¥</text>
<text class="text30px text-bold" v-if="data.length > 0">{{data[0].payMonthSum / 1000}}</text>
<text class="text30px text-bold" v-else>0</text>
</view>
</unicloud-db>
<unicloud-db ref="udb" v-slot:default="{data, loading, error, options}" collection="pay"
:where="`pay_date > ${selectDateStart} && pay_date < ${selectDateEnd} && openid == '${userInfo.openid}' && is_remove == 0`"
groupby="pay_date" group-field="sum(pay_num) as payDaySum" orderby="pay_date desc" loadtime="manual">
<!-- 循环日期 -->
<view class="detail-list" v-for="(item,index) in data" :key="index" v-after>
<view class="detail-date flex align-center">
<uni-dateformat :date="item.pay_date" format="yyyy-MM-dd"></uni-dateformat>
<view class="body-padding">(¥{{item.payDaySum / 1000}})</view>
</view>
<view class="day-pay bg-white main-margin-top mian-box-shadow main-border-radius">
<unicloud-db v-slot:default="{data, loading, error, options}" v-if="data"
collection="pay, pay-type"
:where="`pay_date == ${item.pay_date} && openid == '${userInfo.openid}' && is_remove == 0`"
orderby="pay_date" loadtime="auto">
<!-- 每日消费详细 -->
<view class="day-pay-detail flex justify-between main-padding-top-down body-padding main-border-bottom"
v-for="(item1,index) in data" :key="index">
<text>{{item1.pay_type[0].type_name}}</text><text>¥{{item1.pay_num / 1000}}</text>
</view>
<!-- 每日消费明细结束 -->
</unicloud-db>
</view>
</view>
<!-- 循环日期结束 -->
</unicloud-db>
<script steup>
// 重新加载数据
function udbloadData() {
udb.value.loadData({
clear: true
})
udbSum.value.loadData({
clear: true
})
}
// 日期选择
function pickerDateChange(e) {
selectDate.value = e.detail.value
}
// 前往记一笔页面
function toNewView() {
uni.navigateTo({
url: '/pages/index/new/new'
})
}
onReady(() => {
udbloadData()
})
onShow(() => {
udbloadData()
})
</script>
预期结果:
里层数据更新
里层数据更新
实际结果:
里层数据没有更新
里层数据没有更新
bug描述:
udb组件嵌套,里层组件数据不更新。 里层组件where依赖外部组件循环出来的值, 页面第一次加载数据正常显示, 当添加数据后返回页面,外层数据可以正常更新,但是里层数据不会更新
1 个回复
DCloud_uni-ad_HDX
重复问题 https://ask.dcloud.net.cn/question/184447