收藏
回答

在页面上为什么获取不到ID?

  <movable-area class="area" >

        <movable-view direction="horizontal"  class="view" >{{userMessage.nickName}}</movable-view>

        <navigator url="{{'/pages/detail/detail? userId=' + userMessage._id}}open-type="navigate">

          <image src="{{userMessage.userPhoto}}" />

        </navigator>

        <view class="delete" >删除</view>

</movable-area>

为什么这样获取不到id呢?

 lifetimes: {

    attached: function() {

        db.collection('users').doc(this.data.messageId).field({

 userPhoto:true,

          nickName:true

        }).get().then((res)=>{

          this.setData({

            userMessage: res.data

          })

        })

    }

  }

这是报错

VM2036 WAService.js:2 Error: errCode: -1  | errMsg: collection.doc:fail docId must not be empty; at collection.doc api;


回答关注问题邀请回答
收藏

1 个回答

  • 默
    2021-01-26

    拼接有问题

    url=“/pages/index/index?userid={{id}}” 
    
    2021-01-26
    有用
    回复 1
    • shen
      shen
      2021-01-26
      他那样也没问题,应该是?后有空格了
      2021-01-26
      回复
登录 后发表内容
问题标签