小程序
小游戏
企业微信
微信支付
扫描小程序码分享
控制台:
AppData:
4 个回答
加粗
标红
插入代码
插入链接
插入图片
上传视频
请具体描述问题出现的流程,并提供能复现问题的简单代码片段(https://developers.weixin.qq.com/miniprogram/dev/devtools/minicode.html)。
你好,麻烦通过点击下方“反馈信息”按钮,提供出现问题的。
代码如下:
<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 class="">3333</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 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>
贴代码看看。
你不贴代码片段,没人能帮你。
关注后,可在微信内接收相应的重要提醒。
请使用微信扫描二维码关注 “微信开放社区” 公众号
请具体描述问题出现的流程,并提供能复现问题的简单代码片段(https://developers.weixin.qq.com/miniprogram/dev/devtools/minicode.html)。
代码如下:
<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>
贴代码看看。
你不贴代码片段,没人能帮你。