Skip to content

Commit

Permalink
Exercise 3.2
Browse files Browse the repository at this point in the history
  • Loading branch information
d-levin committed Sep 7, 2017
1 parent 1e4db83 commit 2ee6de2
Showing 1 changed file with 14 additions and 4 deletions.
18 changes: 14 additions & 4 deletions 3-render-function/3.2-render-comp.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,22 +2,32 @@

<div id="app">
<example :ok="ok"></example>
<button @click="ok = !ok"></button>
</div>

<script>
const Foo = {
// Implement this!
functional: true,
render: h => h('div', 'foo')
}

const Bar = {
// Implement this!
functional: true,
render: h => h('div', 'bar')
}

Vue.component('example', {
// Implement this!
functional: true,
props: {
ok: Boolean
},
render: (h, context) => h(context.props.ok ? Foo : Bar)
})

new Vue({
el: '#app'
el: '#app',
data: {
ok: true
}
})
</script>

0 comments on commit 2ee6de2

Please sign in to comment.