surveyjs / survey-library

Free JavaScript form builder library with integration for React, Angular, Vue, jQuery, and Knockout.
https://surveyjs.io/form-library
MIT License
4.09k stars 795 forks source link

Timed Quizes not working in VueJS #903

Closed omkardusane closed 6 years ago

omkardusane commented 6 years ago

Reporting a bug.

Current behavior:

when I try to create a quiz with following attributes,

 maxTimeToFinish: 60,
 maxTimeToFinishPage: 10,

It throws an error saying

 Property or method "start" is not defined on the instance but referenced during render. Make sure to declare reactive data properties in the data option.

found in

---> <Survey> at /home/travis/build/surveyjs/surveyjs/src/vue/survey.vue

Expected behavior:

timed quiz should work as it works in surveyjs.io's designer

To reproduce the current behavior (if this is a bug):

use this json and Latest Vuejs binding of surveyjs:

{
 title: "Anatomy and Physiology",
 completedHtml: "<h4>You have answered correctly <b>{correctedAnswers}</b> questions from <b>{questionCount}</b>.</h4>",
 pages: [
  {
   name: "page1",
   elements: [
    {
     type: "html",
     name: "question1",
     html: "You are about to start quiz by history. <br/>You have total of 5 minutes to complete this test.<br/>Please click on <b>'Start Quiz'</b> button when you are ready."
    }
   ]
  },
  {
   name: "page2",
   elements: [
    {
     type: "text",
     name: "Anterior pictutaory gland",
     title: "Hormones produced by Anterior pictutaory gland",
     correctAnswer: "abcd"
    },
    {
     type: "text",
     name: "Basic functional unit of body.",
     title: "What is the basic functional unit of body?",
     correctAnswer: "abcd"
    }
   ]
  }
 ],
 showProgressBar: "bottom",
 startSurveyText: "StartQuiz",
 firstPageIsStarted: true,
 maxTimeToFinish: 60,
 maxTimeToFinishPage: 10,
 showTimerPanel: "top"
}

Test code:

Will attach a plunkr in comment

Specs

Error Stacktrace


[Vue warn]: Property or method "start" is not defined on the instance but referenced during render. Make sure to declare reactive data properties in the data option.

found in

---> <Survey> at /home/travis/build/surveyjs/surveyjs/src/vue/survey.vue

vue.js:440 [Vue warn]: Invalid handler for event "click": got undefined

found in

---> <Survey> at /home/travis/build/surveyjs/surveyjs/src/vue/survey.vue

vue.js:440 [Vue warn]: Property or method "start" is not defined on the instance but referenced during render. Make sure to declare reactive data properties in the data option.

found in

---> <Survey> at /home/travis/build/surveyjs/surveyjs/src/vue/survey.vue

[Vue warn]: Invalid handler for event "click": got undefined

found in

---> <Survey> at /home/travis/build/surveyjs/surveyjs/src/vue/survey.vue
tsv2013 commented 6 years ago

Thank you for the report. It's a bug. We'll fix it.

tsv2013 commented 6 years ago

Fixed

omkardusane commented 6 years ago

Thanks @tsv2013, It works now.