@@ -30,7 +30,7 @@ const tests = [
30
30
to : `const A = <MyComponent model={{
31
31
value: a.b,
32
32
callback: $$v => {
33
- a.b = $$v;
33
+ this.$set(a, "b", $$v) ;
34
34
}
35
35
}} />;` ,
36
36
} ,
@@ -40,7 +40,7 @@ const tests = [
40
40
to : `const A = <my-component model={{
41
41
value: a.b,
42
42
callback: $$v => {
43
- a.b = $$v;
43
+ this.$set(a, "b", $$v) ;
44
44
}
45
45
}} />;` ,
46
46
} ,
@@ -50,7 +50,7 @@ const tests = [
50
50
to : `const A = <a.b model={{
51
51
value: a.b,
52
52
callback: $$v => {
53
- a.b = $$v;
53
+ this.$set(a, "b", $$v) ;
54
54
}
55
55
}} />;` ,
56
56
} ,
@@ -60,7 +60,7 @@ const tests = [
60
60
to : `const A = <MyComponent model={{
61
61
value: a.b,
62
62
callback: $$v => {
63
- a.b = this._n($$v);
63
+ this.$set(a, "b", this._n($$v) );
64
64
}
65
65
}} />;` ,
66
66
} ,
@@ -70,7 +70,7 @@ const tests = [
70
70
to : `const A = <MyComponent model={{
71
71
value: a.b,
72
72
callback: $$v => {
73
- a.b = typeof $$v === "string" ? $$v.trim() : $$v;
73
+ this.$set(a, "b", typeof $$v === "string" ? $$v.trim() : $$v) ;
74
74
}
75
75
}} />;` ,
76
76
} ,
@@ -80,7 +80,7 @@ const tests = [
80
80
to : `const A = <MyComponent model={{
81
81
value: a.b,
82
82
callback: $$v => {
83
- a.b = this._n(typeof $$v === "string" ? $$v.trim() : $$v);
83
+ this.$set(a, "b", this._n(typeof $$v === "string" ? $$v.trim() : $$v) );
84
84
}
85
85
}} />;` ,
86
86
} ,
@@ -99,7 +99,7 @@ const tests = [
99
99
from : `const A = <select vModel={a.b} />` ,
100
100
to : `const A = <select on-change={$event => {
101
101
const $$selectedVal = Array.prototype.filter.call($event.target.options, o => o.selected).map(o => "_value" in o ? o._value : o.value);
102
- a.b = $event.target.multiple ? $$selectedVal : $$selectedVal[0];
102
+ this.$set(a, "b", $event.target.multiple ? $$selectedVal : $$selectedVal[0]) ;
103
103
}} {...{
104
104
directives: [{
105
105
name: "model",
@@ -113,7 +113,7 @@ const tests = [
113
113
from : `const A = <select vModel_number={a.b} />` ,
114
114
to : `const A = <select on-change={$event => {
115
115
const $$selectedVal = Array.prototype.filter.call($event.target.options, o => o.selected).map(o => this._n("_value" in o ? o._value : o.value));
116
- a.b = $event.target.multiple ? $$selectedVal : $$selectedVal[0];
116
+ this.$set(a, "b", $event.target.multiple ? $$selectedVal : $$selectedVal[0]) ;
117
117
}} {...{
118
118
directives: [{
119
119
name: "model",
@@ -137,12 +137,12 @@ const tests = [
137
137
$$i = this._i($$a, $$v);
138
138
139
139
if ($$el.checked) {
140
- $$i < 0 && (a.b = $$a.concat([$$v]));
140
+ $$i < 0 && this.$set(a, "b", $$a.concat([$$v]));
141
141
} else {
142
- $$i > -1 && (a.b = $$a.slice(0, $$i).concat($$a.slice($$i + 1)));
142
+ $$i > -1 && this.$set(a, "b", $$a.slice(0, $$i).concat($$a.slice($$i + 1)));
143
143
}
144
144
} else {
145
- a.b = $$c;
145
+ this.$set(a, "b", $$c) ;
146
146
}
147
147
}} type="checkbox" domProps-checked={Array.isArray(a.b) ? this._i(a.b, null) > -1 : a.b} {...{
148
148
directives: [{
@@ -165,12 +165,12 @@ const tests = [
165
165
$$i = this._i($$a, $$v);
166
166
167
167
if ($$el.checked) {
168
- $$i < 0 && (a.b = $$a.concat([$$v]));
168
+ $$i < 0 && this.$set(a, "b", $$a.concat([$$v]));
169
169
} else {
170
- $$i > -1 && (a.b = $$a.slice(0, $$i).concat($$a.slice($$i + 1)));
170
+ $$i > -1 && this.$set(a, "b", $$a.slice(0, $$i).concat($$a.slice($$i + 1)));
171
171
}
172
172
} else {
173
- a.b = $$c;
173
+ this.$set(a, "b", $$c) ;
174
174
}
175
175
}} type="checkbox" domProps-checked={Array.isArray(a.b) ? this._i(a.b, null) > -1 : a.b} {...{
176
176
directives: [{
@@ -195,12 +195,12 @@ const tests = [
195
195
$$i = this._i($$a, $$v);
196
196
197
197
if ($$el.checked) {
198
- $$i < 0 && (a.b = $$a.concat([$$v]));
198
+ $$i < 0 && this.$set(a, "b", $$a.concat([$$v]));
199
199
} else {
200
- $$i > -1 && (a.b = $$a.slice(0, $$i).concat($$a.slice($$i + 1)));
200
+ $$i > -1 && this.$set(a, "b", $$a.slice(0, $$i).concat($$a.slice($$i + 1)));
201
201
}
202
202
} else {
203
- a.b = $$c;
203
+ this.$set(a, "b", $$c) ;
204
204
}
205
205
}} type="checkbox" domProps-checked={Array.isArray(a.b) ? this._i(a.b, "abc") > -1 : this._q(a.b, trueVal)} {...{
206
206
directives: [{
@@ -214,7 +214,7 @@ const tests = [
214
214
name : 'Generic input[type="radio"] vModel' ,
215
215
from : `const A = <input type="radio" vModel={a.b} />` ,
216
216
to : `const A = <input on-change={$event => {
217
- a.b = null;
217
+ this.$set(a, "b", null) ;
218
218
}} type="radio" domProps-checked={this._q(a.b, null)} {...{
219
219
directives: [{
220
220
name: "model",
@@ -227,7 +227,7 @@ const tests = [
227
227
name : 'input[type="radio"] vModel_number' ,
228
228
from : `const A = <input type="radio" vModel_number={a.b} value="10" />` ,
229
229
to : `const A = <input on-change={$event => {
230
- a.b = this._n("10");
230
+ this.$set(a, "b", this._n("10") );
231
231
}} type="radio" domProps-checked={this._q(a.b, this._n("10"))} {...{
232
232
directives: [{
233
233
name: "model",
@@ -243,7 +243,7 @@ const tests = [
243
243
from : `const A = <input type="text" vModel={a.b} />` ,
244
244
to : `const A = <input on-input={$event => {
245
245
if ($event.target.composing) return;
246
- a.b = $event.target.value;
246
+ this.$set(a, "b", $event.target.value) ;
247
247
}} type="text" domProps-value={a.b} {...{
248
248
directives: [{
249
249
name: "model",
@@ -257,7 +257,7 @@ const tests = [
257
257
from : `const A = <textarea vModel={a.b} />` ,
258
258
to : `const A = <textarea on-input={$event => {
259
259
if ($event.target.composing) return;
260
- a.b = $event.target.value;
260
+ this.$set(a, "b", $event.target.value) ;
261
261
}} domProps-value={a.b} {...{
262
262
directives: [{
263
263
name: "model",
@@ -272,7 +272,7 @@ const tests = [
272
272
to : `const A = <input on-blur={$event => {
273
273
this.$forceUpdate();
274
274
}} on-change={$event => {
275
- a.b = this._n($event.target.value.trim());
275
+ this.$set(a, "b", this._n($event.target.value.trim() ));
276
276
}} type="text" domProps-value={a.b} {...{
277
277
directives: [{
278
278
name: "model",
@@ -289,7 +289,7 @@ const tests = [
289
289
name : 'input[type="range"] vModel' ,
290
290
from : `const A = <input type="range" vModel={a.b} />` ,
291
291
to : `const A = <input on-__r={$event => {
292
- a.b = $event.target.value;
292
+ this.$set(a, "b", $event.target.value) ;
293
293
}} type="range" domProps-value={a.b} {...{
294
294
directives: [{
295
295
name: "model",
0 commit comments