新增上一页功能,BGM自动引入

This commit is contained in:
Andy Leong
2024-01-11 16:10:51 +08:00
parent bbef428f80
commit de023d9c2e
4 changed files with 46 additions and 11 deletions

View File

@@ -13,7 +13,7 @@
<!-- 查看结果 -->
<Button v-if="showResultBtn" @click="showResult">查看结果</Button>
<!-- 下一页 -->
<Button @click="nextPage">一页</Button>
<Button v-show="currentId != 0" @click="prevePage">一页</Button>
</div>
</div>
</div>
@@ -40,11 +40,19 @@ const answerFn = (item, event) => {
activeId.value = item.aid
debounceTap(e, () => {
let cid = questionList.value[currentId.value].id
answerList.value.push({
qid: cid,
answer: item.secore,
text: item.text
})
let has = answerList.value.findIndex(obj => obj.qid === cid);
if (has == -1) {
answerList.value.push({
qid: cid,
answer: item.secore,
text: item.text
})
} else {
answerList.value[has].answer = item.secore
answerList.value[has].text = item.text
}
// 更新下一题信息
if (currentId.value >= 11) {
Toast('答题结束')
console.log('答题结束');
@@ -56,7 +64,7 @@ const answerFn = (item, event) => {
currentId.value++
}
// console.log('答案库', answerList.value);
console.log('答案库', answerList.value);
})
}
@@ -80,10 +88,17 @@ const showResult = (event) => {
})
}
const nextPage = () => {
// 上一页函数
const prevePage = (event) => {
let e = event.target
debounceTap(e, () => {
activeId.value = ''
currentId.value--
})
}
</script>
<style lang='scss' scope>