Skip to content

Commit c75aa42

Browse files
committed
simplify v-component usage
1 parent cd90e64 commit c75aa42

File tree

3 files changed

+4
-8
lines changed

3 files changed

+4
-8
lines changed

src/directives/component.js

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,15 +21,11 @@ module.exports = {
2121
if (!Ctor) utils.warn('unknown component: ' + this.arg)
2222
var options = {
2323
el: this.el,
24+
scope: value,
2425
compilerOptions: {
2526
parentCompiler: this.compiler
2627
}
2728
}
28-
if (value) {
29-
options.scope = {
30-
model: value
31-
}
32-
}
3329
this.component = new Ctor(options)
3430
},
3531

test/functional/fixtures/extend.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
<div class="filter">{{filterMsg | nodigits}}</div>
1313
<div class="partial" v-partial="partial-test"></div>
1414
<div class="vm" v-component="vm-test">{{vmMsg}}</div>
15-
<div class="vm-w-model" v-component="vm-w-model:vmData">{{msg + model.msg}}</div>
15+
<div class="vm-w-model" v-component="vm-w-model:vmData">{{selfMsg + msg}}</div>
1616
</div>
1717
<div id="child">
1818
<div class="cvm" v-component="vm-test">{{vmMsg}}</div>
@@ -35,7 +35,7 @@
3535
},
3636
'vm-w-model': {
3737
scope : {
38-
msg: 'component with model '
38+
selfMsg: 'component with model '
3939
}
4040
}
4141
},

test/unit/specs/directives.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -602,7 +602,7 @@ describe('UNIT: Directives', function () {
602602
},
603603
components: {
604604
'component-test-2': {
605-
template: '<span>{{model.msg}}</span>'
605+
template: '<span>{{msg}}</span>'
606606
}
607607
}
608608
})

0 commit comments

Comments
 (0)