-
-
Notifications
You must be signed in to change notification settings - Fork 33.7k
Closed
Description
Setup
Vue.component('bars', {
template: '#bars-template', // is this even necessary? just pickup all "x/template" 's automatically and infer the name from the id?
})
<script type="x/template" id="bars-template">
<svg>
<g v-for="pt in pts">
<rect x="{{pt.x}}" y="{{pt.y}}" width="{{z}}" height="{{z}}"></rect>
</g>
</svg>
</script>
Instance
var d = {
pts: [{x: 1, y:2}, {x: 3, y:4}],
z: 2
}
var v = new Vue({
el: "#graph", // this should pass the data into all child templates automatically
data: d
})
Why do I have to pass data down in my html elem? Why doesn't it have access to the Vue instance that it is a child of like normal html would?
<div id="graph">
<bars :pts="pts"></bars>
</div>
So that I can do this:
<div id="graph">
<bars></bars>
</div>
Metadata
Metadata
Assignees
Labels
No labels