Skip to content

Commit

Permalink
simplify v-component usage
Browse files Browse the repository at this point in the history
  • Loading branch information
yyx990803 committed Dec 23, 2013
1 parent cd90e64 commit c75aa42
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 8 deletions.
6 changes: 1 addition & 5 deletions src/directives/component.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,11 @@ module.exports = {
if (!Ctor) utils.warn('unknown component: ' + this.arg)
var options = {
el: this.el,
scope: value,
compilerOptions: {
parentCompiler: this.compiler
}
}
if (value) {
options.scope = {
model: value
}
}
this.component = new Ctor(options)
},

Expand Down
4 changes: 2 additions & 2 deletions test/functional/fixtures/extend.html
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
<div class="filter">{{filterMsg | nodigits}}</div>
<div class="partial" v-partial="partial-test"></div>
<div class="vm" v-component="vm-test">{{vmMsg}}</div>
<div class="vm-w-model" v-component="vm-w-model:vmData">{{msg + model.msg}}</div>
<div class="vm-w-model" v-component="vm-w-model:vmData">{{selfMsg + msg}}</div>
</div>
<div id="child">
<div class="cvm" v-component="vm-test">{{vmMsg}}</div>
Expand All @@ -35,7 +35,7 @@
},
'vm-w-model': {
scope : {
msg: 'component with model '
selfMsg: 'component with model '
}
}
},
Expand Down
2 changes: 1 addition & 1 deletion test/unit/specs/directives.js
Original file line number Diff line number Diff line change
Expand Up @@ -602,7 +602,7 @@ describe('UNIT: Directives', function () {
},
components: {
'component-test-2': {
template: '<span>{{model.msg}}</span>'
template: '<span>{{msg}}</span>'
}
}
})
Expand Down

0 comments on commit c75aa42

Please sign in to comment.