Complete the code to define a Vue component using a template.
<template>
<div>{{ [1] }}</div>
</template>The template uses the message data property to display text.
Complete the code to create a render function that returns a div with text.
export default {
render() {
return [1]('div', 'Hello Vue')
}
}The render function uses the h helper to create virtual DOM nodes.
Fix the error in the render function by completing the missing part.
export default {
render() {
return this.[1]('span', this.text)
},
data() {
return { text: 'Hi' }
}
}The render function should call h to create elements, not 'render' or 'setup'.
Fill both blanks to create a render function that returns a list of items.
export default {
render() {
return this.[1]('ul', this.items.map(item => this.[2]('li', item)))
},
data() {
return { items: ['a', 'b', 'c'] }
}
}Both blanks use the h function to create elements in the render function.
Fill all three blanks to create a render function with a conditional element.
export default {
render() {
return this.[1]('div', [
this.showTitle ? this.[2]('h1', 'Title') : null,
this.[3]('p', 'Content here')
])
},
data() {
return { showTitle: true }
}
}The outer element uses setup (incorrect), inner elements use render and createElement (incorrect). This is a trick question to test understanding of consistent usage.