fix: 修复预览显示页数异常
This commit is contained in:
@@ -1,9 +1,11 @@
|
||||
import { defineStore } from 'pinia';
|
||||
import { ref, computed } from 'vue';
|
||||
import { ref, computed, watch } from 'vue';
|
||||
|
||||
export const useQuestionStore = defineStore('questionStore', () => {
|
||||
const questionsData = ref();
|
||||
|
||||
// 是否是模板模式
|
||||
const isTemplate = ref<boolean>(true);
|
||||
// styleInfo 主题样式
|
||||
const styleInfo = computed(() => questionsData.value?.survey?.style || {});
|
||||
// 当前页数
|
||||
@@ -18,6 +20,7 @@ export const useQuestionStore = defineStore('questionStore', () => {
|
||||
const localPageTimer = ref({});
|
||||
// 当前页问卷
|
||||
const questions = computed(() => {
|
||||
if (isTemplate.value) return questionsData.value?.questions;
|
||||
const currentPages = pages.value[page.value - 1] || [];
|
||||
return (questionsData.value?.questions || []).filter((quetion: any) =>
|
||||
currentPages.find((index: any) => quetion.question_index === index)
|
||||
@@ -48,6 +51,7 @@ export const useQuestionStore = defineStore('questionStore', () => {
|
||||
prevLoading,
|
||||
localPageTimer,
|
||||
questions,
|
||||
showPage
|
||||
showPage,
|
||||
isTemplate
|
||||
};
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user