I'm taking an online course which corrects code using a bot. In this course I'm learnig HTML, JS and Vue.JS.
The assignemnt is to create a component, greet that produces <div>Welcome, Alice!</div> when it's called using <greet></greet> The assignment also wants me to use data and methods to make it so it says Welcome, Bob instead when you click om the div element in the component. It tells me to use the data and methods key in the component.
This is my code so far, but I'm stuck. HTML
<body>
<div id="app"><greet></greet>
</div>
</body>
Vue code:
Vue.component('greet', {
data() {
return {
}
},
template: '<div>Welcome</div>'
})
new Vue({ el: '#app' })
How do I make it so it says Welcome, Alice! and when pressed, it says Welcome, Bob! ? The bot gives me an output of
file.js
✓ exists
✓ is valid JavaScript
1) renders the correct markup when no clicks are made
2) renders the correct markup when one click is made