收藏
回答

微信开发者工具控制台可以显示数据,但AppData里没有?

控制台:

AppData:


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

5 个回答

  • Demons
    Demons
    2023-05-20

    请具体描述问题出现的流程,并提供能复现问题的简单代码片段(https://developers.weixin.qq.com/miniprogram/dev/devtools/minicode.html)。

    2023-05-20
    有用
    回复
  • 那一抹笑😃 穿透阳光
    那一抹笑😃 穿透阳光
    2023-05-20

    你是说最后一个输出,没有数据吗

    2023-05-20
    有用
    回复 2
  • Beast VI
    Beast VI
    2023-05-20

    代码如下:

    <template>

    <view>

    <view class=""  v-for="(item, i) in Question1" :key="i">

      <view class="cate-lv2-title">{{item}}</view>

      <view class="cate-lv2-title" v-for="(item, j) in Option1[i]" :key="j">

        {{item}}

      </view>

      <input class="input1" type="text" placeholder="请输入答案" v-model="answer1[i]" />

    </view>

        <view class="">3333</view>

    </view>

    </template>


    <script>

    export default {

    data() {

    return {

    id:0,

            Question1: [],

            NUM: 0,

            Option1: [],

            Answer1: [],

            answer1: [],

            points1: 0,

            Question2: [],

            Option2: [],

            Answer2: [],

            answer2: [],

            points2: 0,

            Question3: [],

            Option3: [],

            Answer3: [],

            answer3: [],

            points3: 0,

    };

    },

        onLoad(option) {

          wx.cloud.init()

          this.id=option.id

          this.getdata()

        },

        methods:{

          getdata:function(e){

            var _this=this

            const db = wx.cloud.database()

              var _this=this

              var num1 = 0

              var num2 = 0

              var num3 = 0

            db.collection('question1').get().then(res => {

              

                for (var i = 0; i < res.data.length; i++) {

                  if (res.data[i].zhangjie == 1) {

                    _this.Question1[i] = res.data[i].question

                    this.Option1[i] = res.data[i].option

                    this.Answer1[i] = res.data[i].answer

                    // this.NUM=this.NUM+1

                    num1 = this.Question1.length

                    

                  }

                }

                console.log("Question1",this.Question1)

                for (var i = 0; i < res.data.length - num1; i++) {

                  var num = i + num1

                  if (res.data[num].zhangjie == 2) {

                    this.Question2[i] = res.data[num].question

                    this.Option2[i] = res.data[num].option

                    this.Answer2[i] = res.data[num].answer

                  }

                  num2 = num1 + this.Question2.length

                }

              

                for (var i = 0; i < res.data.length - num2; i++) {

                  var num = i + num2

                  if (res.data[num].zhangjie == 3) {

                    this.Question3[i] = res.data[num].question

                    this.Option3[i] = res.data[num].option

                    this.Answer3[i] = res.data[num].answer

                  }

                  num3 = num2 + this.Question3.length

                }

              

              })

              console.log(this.Question1)

          }


        }

    }

    </script>


    <style lang="scss">


    </style>


    2023-05-20
    有用
    回复 1
    • public
      public
      2023-05-22
      如果是要渲染到页面上, 要使用  this.setData()
      2023-05-22
      回复
  • Jianbo
    Jianbo
    发表于小程序端
    2023-05-20

    贴代码看看。

    2023-05-20
    有用
    回复 1
    • Beast VI
      Beast VI
      2023-05-20
      贴了
      2023-05-20
      回复
  • 从君华
    从君华
    2023-05-20

    你不贴代码片段,没人能帮你。

    2023-05-20
    有用
    回复 1
    • Beast VI
      Beast VI
      2023-05-20
      贴了
      2023-05-20
      回复
登录 后发表内容