<unicloud-db ref="udb" v-slot:default="{data, loading, error, options}" collection="pay"
:where="`pay_date > ${selectDateStart} && pay_date < ${selectDateEnd} && 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">
<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 / 100}})</view>
</view>
<view class="day-pay bg-white main-margin-top mian-box-shadow main-border-radius">
<unicloud-db ref="udb1" v-slot:default="{data, loading, error, options}" collection="pay, pay-type"
:where="`pay_date == ${item.pay_date} && openid == '${openid}' && is_remove == 0`" orderby="pay_date"
loadtime="manual">
<!-- 每日消费详细 -->
<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 / 100}}</text>
</view>
<!-- 每日消费明细结束 -->
</unicloud-db>
onReady() {
this.$refs.udb.loadData({clear: true})
this.$refs.udb1.loadData({clear: true})
console.log('udb - ' + this.$refs.udb)
console.log(this.$refs.udb1)
}
// 报错: TypeError: Cannot convert object to primitive value
- 发布:2024-01-02 16:18
- 更新:2024-01-04 18:07
- 阅读:181
产品分类: uniapp/小程序/微信
PC开发环境操作系统: Mac
PC开发环境操作系统版本号: 10.15
HBuilderX类型: 正式
HBuilderX版本号: 3.99
第三方开发者工具版本号: 最新
基础库版本号: 最新
项目创建方式: HBuilderX
示例代码:
操作步骤:
<unicloud-db ref="udb" v-slot:default="{data, loading, error, options}" collection="pay"
:where="`pay_date > ${selectDateStart} && pay_date < ${selectDateEnd} && 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">
<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 / 100}})</view>
</view>
<view class="day-pay bg-white main-margin-top mian-box-shadow main-border-radius">
<unicloud-db ref="udb1" v-slot:default="{data, loading, error, options}" collection="pay, pay-type"
:where="`pay_date == ${item.pay_date} && openid == '${openid}' && is_remove == 0`" orderby="pay_date"
loadtime="manual">
<!-- 每日消费详细 -->
<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 / 100}}</text>
</view>
<!-- 每日消费明细结束 -->
</unicloud-db>
onReady() {
this.$refs.udb.loadData({clear: true})
this.$refs.udb1.loadData({clear: true})
console.log('udb - ' + this.$refs.udb)
console.log(this.$refs.udb1)
}
// 报错: TypeError: Cannot convert object to primitive value
<unicloud-db ref="udb" v-slot:default="{data, loading, error, options}" collection="pay"
:where="`pay_date > ${selectDateStart} && pay_date < ${selectDateEnd} && 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">
<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 / 100}})</view>
</view>
<view class="day-pay bg-white main-margin-top mian-box-shadow main-border-radius">
<unicloud-db ref="udb1" v-slot:default="{data, loading, error, options}" collection="pay, pay-type"
:where="`pay_date == ${item.pay_date} && openid == '${openid}' && is_remove == 0`" orderby="pay_date"
loadtime="manual">
<!-- 每日消费详细 -->
<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 / 100}}</text>
</view>
<!-- 每日消费明细结束 -->
</unicloud-db>
onReady() {
this.$refs.udb.loadData({clear: true})
this.$refs.udb1.loadData({clear: true})
console.log('udb - ' + this.$refs.udb)
console.log(this.$refs.udb1)
}
// 报错: TypeError: Cannot convert object to primitive value
预期结果:
正常更新
正常更新
实际结果:
里层不能更新
里层不能更新
bug描述:
unicloud-db组件嵌套,里层db组件的where依赖外层db组件的data, 里外db组件loadtime="manual"。 当onReadyloadData的时候,获取不到里层的db组件