I get survey from data jsonb, and get to component
My code:
Code<template lang="pug">
survey(:survey="survey_render")
</template>
<script lang="coffee">
import { Survey } from 'survey-vue-ui'
import { StylesManager, Model } from 'survey-core'
import 'survey-core/survey.min.css';
StylesManager.applyTheme("survey")
surveyJson = {"logoPosition":"right","pages":[{"name":"page1","elements":[{"type":"checkbox","name":"question1","title":"как дела","choices": [{"value":"item1","text":"хорошо"},{"value":"item2","text":"норм"}],"hasSelectAll":true,"selectAllText":"все"}, {"type":"text","name":"question2","title":"все ок?"}]}]}
export default {
components: {
Survey
}
props: { survey_item: { type: Object } }
data: ->
{
survey_render: new Model(@survey_item)
}
}
</script>
and this message is render(attached pic)
But, i tried the same json hash from surveyJson variable and it renders
Hello,
Would you please specify the version of the vue library you're running?
For the record: the support for Vue 3 is yet to come. For more information, refer to Support Vue 3 in SurveyJS library.
You may wish to review the following example which shows how to run survey with vue@2.6: Get Started with SurveyJS - Vue.
I look forward to your reply.
Vue 2.6.12
Thank you. Would you please additionally share a sample Survey JSON for research?
I gave a code example, where a survey from the data was written to a variable
surveyJson = {"logoPosition":"right","pages":[{"name":"page1","elements":[{"type":"checkbox","name":"question1","title":"как дела","choices": [{"value":"item1","text":"хорошо"},{"value":"item2","text":"норм"}],"hasSelectAll":true,"selectAllText":"все"}, {"type":"text","name":"question2","title":"все ок?"}]}]}
Hello Odin,
How do you set JSON from your database to the survey model? I believe the issue is here.
Thank you,
Andrew
SurveyJS Team
Raw JsonB in pg
Could you provide the code that set your JSON from database into Survey model?
You can emulate your code, by setting your JSON constant on setTimeout() function.
Thank you,
Andrew
SurveyJS Team