File tree Expand file tree Collapse file tree 2 files changed +23
-0
lines changed Expand file tree Collapse file tree 2 files changed +23
-0
lines changed Original file line number Diff line number Diff line change @@ -49,6 +49,14 @@ export default {
4949 jsx: {
5050 type: Boolean ,
5151 default: false
52+ },
53+ /**
54+ * Outside data to the preview
55+ * @example { count: 1 }
56+ */
57+ dataScope: {
58+ type: Object ,
59+ default : () => {}
5260 }
5361 },
5462 data () {
@@ -109,6 +117,11 @@ export default {
109117 adaptCreateElement,
110118 concatenate
111119 ) || {};
120+
121+ if (this .dataScope ) {
122+ const mergeData = { ... data .data (), ... this .dataScope };
123+ data .data = () => mergeData;
124+ }
112125 }
113126 if (renderedComponent .template ) {
114127 // if this is a pure template or if we are in hybrid vsg mode,
Original file line number Diff line number Diff line change 66 :language =" lang"
77 :prismLang =" prismLang"
88 :requires =" requires"
9+ :data-scope =" dataScope"
910 :components =" components"
1011 >
1112 <template v-slot :editor >
2526 :components =" components"
2627 :requires =" requires"
2728 :jsx =" jsx"
29+ :data-scope =" dataScope"
2830 />
2931 </template >
3032 </component >
@@ -110,6 +112,14 @@ export default {
110112 editorProps: {
111113 type: Object ,
112114 default : () => ({})
115+ },
116+ /**
117+ * Outside data to the preview
118+ * @example { count: 1 }
119+ */
120+ dataScope: {
121+ type: Object ,
122+ default : () => {}
113123 }
114124 },
115125 data () {
You can’t perform that action at this time.
0 commit comments