Skip to content

Commit

Permalink
Work for #2756 - Support Vue 3 in SurveyJS library - fixed Vue3 react…
Browse files Browse the repository at this point in the history
…ivity
  • Loading branch information
tsv2013 committed Nov 28, 2022
1 parent befe3d1 commit 346a21a
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 2 deletions.
2 changes: 2 additions & 0 deletions packages/survey-vue-ui/src/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ export default defineComponent({
data() {
const survey = new Model({});
survey.title = "It works!";
survey.description = "Survey description";
survey.surveyId = "Survey1";
return {
survey: survey as any,
};
Expand Down
4 changes: 2 additions & 2 deletions packages/survey-vue-ui/src/base.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import type { Base } from "survey-core";
import { ref, defineComponent, type ComponentOptions } from "vue";
import { ref, defineComponent, type ComponentOptions, unref } from "vue";

function makeReactive(surveyElement: Base) {
surveyElement.iteratePropertiesHash((propertiesHash: any, name: any) => {
Expand All @@ -15,7 +15,7 @@ function makeReactive(surveyElement: Base) {
// (<any>Vue.util).defineReactive(propertiesHash, name, propertiesHash[name]);
propertiesHash[name] = ref(propertiesHash[name]);
}
return propertiesHash[name].value;
return unref(propertiesHash[name]);
};
surveyElement.setPropertyValueCoreHandler = (
propertiesHash: any,
Expand Down
2 changes: 2 additions & 0 deletions packages/survey-vue-ui/src/components/Survey.vue
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
<template>
<div class="survey">
<h1>{{ model.title }}</h1>
<h2>{{ model.description }}</h2>
<div>{{ model.surveyId }}</div>
</div>
</template>

Expand Down

0 comments on commit 346a21a

Please sign in to comment.