<template>
<!--不报错 -->
<!-- <unicloud-db ref="udb" v-slot:default="{data, loading, error, options}" collection="book,author" where="name == '水浒传'"> -->
<!--报错版本 -->
<unicloud-db v-slot:default="{data, loading, error, options}" :collection="colList">
<view v-if="error">{{error.message}}</view>
<view v-else-if="loading">正在加载...</view>
<view v-else>
{{data}}
</view>
</unicloud-db>
</template>
<script>
const db = uniCloud.database()
export default {
data() {
return {
colList: [
db.collection('book').where('name == "水浒传"').getTemp(),
db.collection('author').getTemp()
]
}
},
onReady() {},
methods: {}
}
</script>
y***@yeah.net
- 发布:2022-04-27 19:31
- 更新:2022-04-30 17:52
- 阅读:623
产品分类: uniCloud/App
示例代码:
操作步骤:
只要使用上述代码即可
只要使用上述代码即可
预期结果:
不报错
不报错
实际结果:
**mp.runtime.esm.js?66fd:5634 TypeError: Cannot read property '0' of undefined**
at a.mainCollection (unicloud-db.vue?5078:170)
at Pr.get (mp.runtime.esm.js?66fd:4419)
at Pr.evaluate (mp.runtime.esm.js?66fd:4524)
at a.eval [as mainCollection] (mp.runtime.esm.js?66fd:4799)
at eval (mp.runtime.esm.js?66fd:5596)
at Array.reduce (<anonymous>)
at bo (mp.runtime.esm.js?66fd:5595)
at a.wo [as __patch__] (mp.runtime.esm.js?66fd:5632)
at a.e._update (mp.runtime.esm.js?66fd:3956)
at a.r (mp.runtime.esm.js?66fd:5700)
at Pr.get (mp.runtime.esm.js?66fd:4419)
at new Pr (mp.runtime.esm.js?66fd:4408)
at xo (mp.runtime.esm.js?66fd:5706)
at a.Gr.$mount (mp.runtime.esm.js?66fd:6039)
at Object.__lifetimes_attached (index.js?f266:2336)
at Object.r.lifetimes.attached (index.js?f266:2341)
wo @ mp.runtime.esm.js?66fd:5634
e._update @ mp.runtime.esm.js?66fd:3956
r @ mp.runtime.esm.js?66fd:5700
Pr.get @ mp.runtime.esm.js?66fd:4419
Pr @ mp.runtime.esm.js?66fd:4408
xo @ mp.runtime.esm.js?66fd:5706
Gr.$mount @ mp.runtime.esm.js?66fd:6039
__lifetimes_attached @ index.js?f266:2336
r.lifetimes.attached @ index.js?f266:2341
t.tryCatch @ VM138:16
eval @ VM138:16
n.callComponentLifetime @ VM138:16
n.attached @ VM138:16
eval @ VM138:16
qc.emit @ VM138:2
eval @ VM138:2
subscribeHandler @ VM138:2
invokeService @ C:\Program Files\@bytedminiprogram-ide\resources\app\extensions\miniprogram-extension\node_modules\@byted\miniprogram-simulator\public\shell\preload\bgWebviewPreload.js:129
(anonymous) @ C:\Program Files\@bytedminiprogram-ide\resources\app\extensions\miniprogram-extension\node_modules\@byted\miniprogram-simulator\public\shell\preload\bgWebviewPreload.js:432
(anonymous) @ C:\Program Files\@bytedminiprogram-ide\resources\app\extensions\miniprogram-extension\node_modules\@byted\miniprogram-simulator\public\shell\preload\bgWebviewPreload.js:1
emit @ events.js:327
onMessage @ electron/js2c/renderer_init.js:91
appInit.js:73 onDBError {code: "SYNTAX_ERROR", message: "查询语句存在错误,请检查传入的临时表是否正确"}
appInit.js:78 SYNTAX_ERROR 查询语句存在错误,请检查传入的临时表是否正确
f @ appInit.js:78
eval @ index.js?a9ff:1
value @ index.js?a9ff:1
eval @ index.js?a9ff:1
unicloud-db.vue?5078:561 Error: 查询语句存在错误,请检查传入的临时表是否正确
at eval (index.js?a9ff:1)
**mp.runtime.esm.js?66fd:5634 TypeError: Cannot read property '0' of undefined**
at a.mainCollection (unicloud-db.vue?5078:170)
at Pr.get (mp.runtime.esm.js?66fd:4419)
at Pr.evaluate (mp.runtime.esm.js?66fd:4524)
at a.eval [as mainCollection] (mp.runtime.esm.js?66fd:4799)
at eval (mp.runtime.esm.js?66fd:5596)
at Array.reduce (<anonymous>)
at bo (mp.runtime.esm.js?66fd:5595)
at a.wo [as __patch__] (mp.runtime.esm.js?66fd:5632)
at a.e._update (mp.runtime.esm.js?66fd:3956)
at a.r (mp.runtime.esm.js?66fd:5700)
at Pr.get (mp.runtime.esm.js?66fd:4419)
at new Pr (mp.runtime.esm.js?66fd:4408)
at xo (mp.runtime.esm.js?66fd:5706)
at a.Gr.$mount (mp.runtime.esm.js?66fd:6039)
at Object.__lifetimes_attached (index.js?f266:2336)
at Object.r.lifetimes.attached (index.js?f266:2341)
wo @ mp.runtime.esm.js?66fd:5634
e._update @ mp.runtime.esm.js?66fd:3956
r @ mp.runtime.esm.js?66fd:5700
Pr.get @ mp.runtime.esm.js?66fd:4419
Pr @ mp.runtime.esm.js?66fd:4408
xo @ mp.runtime.esm.js?66fd:5706
Gr.$mount @ mp.runtime.esm.js?66fd:6039
__lifetimes_attached @ index.js?f266:2336
r.lifetimes.attached @ index.js?f266:2341
t.tryCatch @ VM138:16
eval @ VM138:16
n.callComponentLifetime @ VM138:16
n.attached @ VM138:16
eval @ VM138:16
qc.emit @ VM138:2
eval @ VM138:2
subscribeHandler @ VM138:2
invokeService @ C:\Program Files\@bytedminiprogram-ide\resources\app\extensions\miniprogram-extension\node_modules\@byted\miniprogram-simulator\public\shell\preload\bgWebviewPreload.js:129
(anonymous) @ C:\Program Files\@bytedminiprogram-ide\resources\app\extensions\miniprogram-extension\node_modules\@byted\miniprogram-simulator\public\shell\preload\bgWebviewPreload.js:432
(anonymous) @ C:\Program Files\@bytedminiprogram-ide\resources\app\extensions\miniprogram-extension\node_modules\@byted\miniprogram-simulator\public\shell\preload\bgWebviewPreload.js:1
emit @ events.js:327
onMessage @ electron/js2c/renderer_init.js:91
appInit.js:73 onDBError {code: "SYNTAX_ERROR", message: "查询语句存在错误,请检查传入的临时表是否正确"}
appInit.js:78 SYNTAX_ERROR 查询语句存在错误,请检查传入的临时表是否正确
f @ appInit.js:78
eval @ index.js?a9ff:1
value @ index.js?a9ff:1
eval @ index.js?a9ff:1
unicloud-db.vue?5078:561 Error: 查询语句存在错误,请检查传入的临时表是否正确
at eval (index.js?a9ff:1)
bug描述:
unicloud-db使用:collection="colList"报错,代码具体见代码示例。
WIN10 字节小程序开发工具版本3.2.7-1 HBuilder 3.4.7.20220422
2 个回复
DCloud_uniCloud_WYQ
未能复现,贴一下你使用的schema文件,另外可以试试升级到HBuilderX 2.4.8看看有无报错
y***@yeah.net (作者)
新建了一个项目(项目和json文件见附件),字节小程序只复现出来如下告警:
未在新工程中复现如下告警:unicloud-db.vue?5078:561 Error: 查询语句存在错误,请检查传入的临时表是否正确