火锅鸡
火锅鸡
  • 发布:2022-07-01 22:48
  • 更新:2022-08-10 12:05
  • 阅读:442

unicloud-db 组件中 where属性无法工作

分类:uni-app
组件: <unicloud-db ref="udb" :collection="collectionList" :where="sWhere" field="bom_id{name},wuliao_code{code},wuliao_price{price},wuliao_count,wuliao_pos,replaces,update_date,create_date" page-data="replace" :orderby="orderby" :getcount="true" :page-size="options.pageSize" page-current="options.pageCurrent" v-slot:default="{data,pagination,loading,error,options}" options="options" loadtime="manual" @load="onqueryload">

...
</unicloud-db>

数据:
data() {
return {
//.where("bom_id=='" + this.bomId+"'")
collectionList: [db.collection('pro_bom_data').getTemp(),
db.collection('pro_bom').getTemp(),
db.collection('pro_wuliao').getTemp()
],
...
}

我的sWhere赋值
this.sWhere = "bom_id=='62bda911f792990001024651'"

pro_bom_data里面的bom_id字段:

    "bom_id": {  
        "bsonType": "string",  
        "title": "BOM编码",  
        "foreignKey": "pro_bom._id",  
        "description": "BOM",  
        "enum": {  
            "collection": "pro_bom",  
            "field": "_id as value, name as text"  
        }  
    },  

为什么这样,查不到数据?

如果我把数据的改成这样,就可以查到
data() {
return {
//.where("bom_id=='" + this.bomId+"'")
collectionList: [db.collection('pro_bom_data').where({'bom_id':'62bda911f792990001024651'}).getTemp(),
db.collection('pro_bom').getTemp(),
db.collection('pro_wuliao').getTemp()
],
...
}

2022-07-01 22:48 负责人:无 分享
已邀请:
4***@qq.com

4***@qq.com

试试模板字符串

  • 火锅鸡 (作者)

    试过的,也还是不行的。

    2022-07-04 11:34

火锅鸡

火锅鸡 (作者)

我的解决办法,参考这个https://ask.dcloud.net.cn/question/148249?notification_id-1107178rf-falseitem_id-204316__answer_id-204316__single-TRUE#!answer_204316

子沐君

子沐君 - 子沐君

你好,朋友 我也在用unicloud-db 也有遇到一些问题 能否加下QQ一起学习踩坑unicloud啊 1576554007我

要回复问题请先登录注册