Fix bug with stale "currentPage" with new SurveyJS plugin
This commit is contained in:
parent
40f0f1cfb8
commit
7b4efca096
|
|
@ -55,6 +55,7 @@
|
|||
data() {
|
||||
return {
|
||||
survey: this.initSurvey(),
|
||||
currentPage: null,
|
||||
surveyData: null,
|
||||
title: '',
|
||||
module: {},
|
||||
|
|
@ -99,8 +100,8 @@
|
|||
};
|
||||
},
|
||||
answers() {
|
||||
return this.survey.currentPage && this.survey.currentPage.elements
|
||||
? this.survey.currentPage.elements.reduce(extractSurveySolutions, [])
|
||||
return this.currentPage && this.currentPage.elements
|
||||
? this.currentPage.elements.reduce(extractSurveySolutions, [])
|
||||
: [];
|
||||
},
|
||||
isTeacher() {
|
||||
|
|
@ -129,6 +130,13 @@
|
|||
survey.data = flatAnswers;
|
||||
}
|
||||
|
||||
this.currentPage = survey.currentPage;
|
||||
|
||||
const updatePage = (sender, {oldCurrentPage, newCurrentPage}) => {
|
||||
console.log(oldCurrentPage, newCurrentPage);
|
||||
this.currentPage = newCurrentPage;
|
||||
};
|
||||
|
||||
const saveSurvey = (sender, {exit}) => {
|
||||
if (this.saveDisabled) {
|
||||
return;
|
||||
|
|
@ -192,6 +200,7 @@
|
|||
});
|
||||
});
|
||||
survey.onCurrentPageChanged.add(saveSurvey);
|
||||
survey.onCurrentPageChanged.add(updatePage);
|
||||
|
||||
survey.css = css;
|
||||
survey.locale = 'de';
|
||||
|
|
|
|||
Loading…
Reference in New Issue