z***@163.com
z***@163.com
  • 发布:2023-09-11 16:23
  • 更新:2023-09-11 16:23
  • 阅读:123

【报Bug】unicloud-db where 条件没法判断null

分类:uniCloud

产品分类: uniCloud/App

示例代码:

表结构:"userId": {  
      "description": "用户id",  
      "foreignKey": "uni-id-users._id",  
      "defaultValue": {  
        "$env": "uid"  
      }  
    }  
数据:{  
    "userId": null,  
    "updateTime": 1694167219128,  
    "name": "111",  
    "phone": "111",  
    "school": "111",  
    "major": "11",  
    "descr": "11",  
    "release": null,  
    "type": 2,  
    "createTime": 1694167219128,  
    "log": "定时器修改"  
}  
 <unicloud-db ref="udb" :collection="collectionList" field="userId,descr,type,release,name,school,major,phone,updateTime" :where="`userId==null`" 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">  
        <uni-table ref="table" :loading="loading" :emptyText="error.message || '没有更多数据'" border stripe type="selection" @selection-change="selectionChange">  
          <uni-tr>  
            <uni-th align="center" filter-type="search" @filter-change="filterChange($event, 'name')" sortable @sort-change="sortChange($event, 'name')">学生名称</uni-th>  
            <uni-th align="center" filter-type="search" @filter-change="filterChange($event, 'phone')" sortable @sort-change="sortChange($event, 'phone')">手机号码</uni-th>  
            <uni-th align="center" filter-type="search" @filter-change="filterChange($event, 'school')" sortable @sort-change="sortChange($event, 'school')">学校</uni-th>  
            <uni-th align="center" filter-type="search" @filter-change="filterChange($event, 'major')" sortable @sort-change="sortChange($event, 'major')">专业</uni-th>  
            <uni-th align="center" filter-type="select" :filter-data="options.filterData.type_localdata" @filter-change="filterChange($event, 'type')">状态</uni-th>  
            <uni-th align="center" filter-type="search" @filter-change="filterChange($event, 'descr')" sortable @sort-change="sortChange($event, 'descr')">备注</uni-th>  
            <uni-th align="center" sortable @sort-change="sortChange($event, 'userId')">跟进人</uni-th>  
            <uni-th align="center" filter-type="timestamp" @filter-change="filterChange($event, 'release')" sortable @sort-change="sortChange($event, 'release')">释放时间</uni-th>  
            <uni-th align="center">操作</uni-th>  
          </uni-tr>  
          <uni-tr v-for="(item,index) in data" :key="index">  
            <uni-td align="center">{{item.name}}</uni-td>  
            <uni-td align="center">{{item.phone}}</uni-td>  
            <uni-td align="center">{{item.school}}</uni-td>  
            <uni-td align="center">{{item.major}}</uni-td>  
            <uni-td align="center">{{options.type_valuetotext[item.type]}}</uni-td>  
            <uni-td align="center">{{item.descr}}</uni-td>  
            <uni-td align="center"><text v-if="item.userId.length>0">{{item.userId[0].nickname}}</text><text v-else></text></uni-td>  
            <uni-td align="center">  
            <uni-dateformat :threshold="[0, 0]" :date="item.release"></uni-dateformat>  
            </uni-td>  

            <uni-td align="center">  
              <view class="uni-group">  
                <!-- <button @click="navigateTo('./edit?id='+item._id, false)" class="uni-button" size="mini" type="primary">修改</button> -->  
                <button @click="navigateTo('./edit?id='+item._id, false)" class="uni-button" size="mini" type="primary">跟进</button>  
                <!-- <button @click="confirmDelete(item._id)" class="uni-button" size="mini" type="warn">删除</button> -->  
              </view>  
            </uni-td>  
          </uni-tr>  
        </uni-table>  
        <view class="uni-pagination-box">  
          <uni-pagination show-icon :page-size="pagination.size" v-model="pagination.current" :total="pagination.count" @change="onPageChanged" />  
        </view>  
      </unicloud-db>```  

操作步骤:

运行代码

预期结果:

返回{
"userId": null,
"updateTime": 1694167219128,
"name": "111",
"phone": "111",
"school": "111",
"major": "11",
"descr": "11",
"release": null,
"type": 2,
"createTime": 1694167219128,
"log": "定时器修改"
}

实际结果:

没有数据

bug描述:

unicloud-db where 条件没法判断null

2023-09-11 16:23 负责人:无 分享
已邀请:

要回复问题请先登录注册