+43
-2
lines changedFilter options
+43
-2
lines changed Original file line number Diff line number Diff line change
@@ -483,7 +483,9 @@ function processAttrs (el) {
483
483
)
484
484
}
485
485
}
486
-
if (isProp || platformMustUseProp(el.tag, el.attrsMap.type, name)) {
486
+
if (!el.component && (
487
+
isProp || platformMustUseProp(el.tag, el.attrsMap.type, name)
488
+
)) {
487
489
addProp(el, name, value)
488
490
} else {
489
491
addAttr(el, name, value)
Original file line number Diff line number Diff line change
@@ -40,7 +40,11 @@ export default function model (
40
40
}
41
41
}
42
42
43
-
if (tag === 'select') {
43
+
if (el.component) {
44
+
genComponentModel(el, value, modifiers)
45
+
// component v-model doesn't need extra runtime
46
+
return false
47
+
} else if (tag === 'select') {
44
48
genSelect(el, value, modifiers)
45
49
} else if (tag === 'input' && type === 'checkbox') {
46
50
genCheckboxModel(el, value, modifiers)
Original file line number Diff line number Diff line change
@@ -36,6 +36,41 @@ describe('Directive v-model component', () => {
36
36
}).then(done)
37
37
})
38
38
39
+
it('should work with native tags with "is"', done => {
40
+
const vm = new Vue({
41
+
data: {
42
+
msg: 'hello'
43
+
},
44
+
template: `
45
+
<div>
46
+
<p>{{ msg }}</p>
47
+
<input is="test" v-model="msg">
48
+
</div>
49
+
`,
50
+
components: {
51
+
test: {
52
+
props: ['value'],
53
+
template: `<input :value="value" @input="$emit('input', $event.target.value)">`
54
+
}
55
+
}
56
+
}).$mount()
57
+
document.body.appendChild(vm.$el)
58
+
waitForUpdate(() => {
59
+
const input = vm.$el.querySelector('input')
60
+
input.value = 'world'
61
+
triggerEvent(input, 'input')
62
+
}).then(() => {
63
+
expect(vm.msg).toEqual('world')
64
+
expect(vm.$el.querySelector('p').textContent).toEqual('world')
65
+
vm.msg = 'changed'
66
+
}).then(() => {
67
+
expect(vm.$el.querySelector('p').textContent).toEqual('changed')
68
+
expect(vm.$el.querySelector('input').value).toEqual('changed')
69
+
}).then(() => {
70
+
document.body.removeChild(vm.$el)
71
+
}).then(done)
72
+
})
73
+
39
74
it('should support customization via model option', done => {
40
75
const spy = jasmine.createSpy('update')
41
76
const vm = new Vue({
You can’t perform that action at this time.
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4