-
-
Notifications
You must be signed in to change notification settings - Fork 33.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- `v-component` now takes only a string value (the component id) - `Vue.component()` now also registers the component id as a custom element - add new directive: `v-with`, which can be used in combination with `v-component` or standalone
- Loading branch information
Showing
10 changed files
with
100 additions
and
39 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,6 +4,7 @@ var prefix = 'v', | |
'text', | ||
'repeat', | ||
'partial', | ||
'with', | ||
'component', | ||
'component-id', | ||
'transition' | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
<head> | ||
<title>Component</title> | ||
<meta charset="utf-8"> | ||
</head> | ||
<body> | ||
<div id="test"> | ||
<!-- v-component + v-with --> | ||
<div id="component-and-with" v-component="avatar" v-with="user"></div> | ||
|
||
<!-- custom element + v-with --> | ||
<avatar id="element-and-with" v-with="user"></avatar> | ||
|
||
<!-- v-with alone --> | ||
<div id="with" v-with="user">{{hi}} {{name}}</div> | ||
|
||
<!-- v-component alone --> | ||
<div id="component" v-component="simple"></div> | ||
|
||
<!-- custom element alone --> | ||
<simple id="element"></simple> | ||
</div> | ||
<script src="../../../dist/vue.js"></script> | ||
<script> | ||
|
||
Vue.config({debug: true}) | ||
|
||
Vue.component('avatar', { | ||
template: '{{hi}} {{name}}', | ||
ready: function () { | ||
console.log(JSON.stringify(this)) | ||
} | ||
}) | ||
|
||
Vue.component('simple', { | ||
template: '{{hi}} {{user.name}}' | ||
}) | ||
|
||
var app = new Vue({ | ||
el: '#test', | ||
data: { | ||
hi: '123', | ||
user: { | ||
name: 'Jack' | ||
} | ||
} | ||
}) | ||
</script> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
casper.test.begin('Components', 5, function (test) { | ||
|
||
casper | ||
.start('./fixtures/component.html') | ||
.then(function () { | ||
var expected = '123 Jack' | ||
test.assertSelectorHasText('#component-and-with', expected) | ||
test.assertSelectorHasText('#element-and-with', expected) | ||
test.assertSelectorHasText('#component', expected) | ||
test.assertSelectorHasText('#with', expected) | ||
test.assertSelectorHasText('#element', expected) | ||
}) | ||
.run(function () { | ||
test.done() | ||
}) | ||
|
||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters