File tree Expand file tree Collapse file tree 2 files changed +5
-15
lines changed Expand file tree Collapse file tree 2 files changed +5
-15
lines changed Original file line number Diff line number Diff line change @@ -48,23 +48,13 @@ Vue.component('json-schema-property', {
48
48
var app = new Vue ( {
49
49
el : '#editor' ,
50
50
data : {
51
- schema : { }
51
+ schema : { } ,
52
+ doc : { }
52
53
} ,
53
54
computed : {
54
55
output : {
55
56
$get : function ( ) {
56
- var self = this ;
57
- var rv = { } ;
58
- var keys = { } ;
59
- if ( self . schema && self . schema . properties ) {
60
- keys = Object . keys ( self . schema . properties ) ;
61
- keys . forEach ( function ( key ) {
62
- rv [ key ] = self . schema . properties [ key ] . value ;
63
- } ) ;
64
- return JSON . stringify ( rv , null , "\t" ) ;
65
- } else {
66
- return { } ;
67
- }
57
+ return JSON . stringify ( this . doc , null , "\t" ) ;
68
58
}
69
59
}
70
60
} ,
Original file line number Diff line number Diff line change 18
18
< form class ="pure-form pure-form-aligned ">
19
19
< h1 v-if ="schema.title "> {{schema.title}}</ h1 >
20
20
< div v-if ="schema.description "> < small > {{schema.description}}</ small > </ div >
21
- < div v-repeat ="schema.properties " v-component ="json-schema-property "> </ div >
21
+ < div v-repeat ="schema.properties " v-component ="json-schema-property " v-with =" doc: doc " > </ div >
22
22
</ form >
23
23
</ div >
24
24
< textarea id ="schema "
@@ -33,7 +33,7 @@ <h1 v-if="schema.title">{{schema.title}}</h1>
33
33
< script id ="json-schema-property " type ="text/vue-template+html ">
34
34
< div class = "pure-control-group" >
35
35
< label for = "{{$key}}" > { { $key} } </ label >
36
- < input name = "{{$key}}" v-model = "value " type = "{{type | input_type}}" />
36
+ < input name = "{{$key}}" v-model = "doc.{{$key}} " type = "{{type | input_type}}" />
37
37
< p class = "pure-help-inline" v-if = "description" > < small > { { description} } </ small > </ p >
38
38
</ div >
39
39
</ script >
You can’t perform that action at this time.
0 commit comments