Menu
×
×
Correct!
Exercise:Write the missing code so that the 'writeText' method is called when the <div> tag is clicked.
<div id="app">
<p>Click on the box below:</p>
<div @(10)=@(11)>
{{ text }}
</div>
</div>
<script src="https://unpkg.com/vue@3/dist/vue.global.js"></script>
<script>
const app = Vue.createApp({
data() {
return {
text: ''
}
},
@(7): {
writeText() {
this.@(4) = 'Hello World!'
}
}
})
app.mount('#app')
</script>
<div id="app">
<p>Click on the box below:</p>
<div v-on:click="writeText">
{{ text }}
</div>
</div>
<script src="https://unpkg.com/vue@3/dist/vue.global.js"></script>
<script>
const app = Vue.createApp({
data() {
return {
text: ''
}
},
methods: {
writeText() {
this.text = 'Hello World!'
}
}
})
app.mount('#app')
</script>
<div id="app">
<p>Click on the box below:</p>
<div v-on:click='writeText'>
{{ text }}
</div>
</div>
<script src="https://unpkg.com/vue@3/dist/vue.global.js"></script>
<script>
const app = Vue.createApp({
data() {
return {
text: ''
}
},
methods: {
writeText() {
this.text = 'Hello World!'
}
}
})
app.mount('#app')
</script>
<div id="app">
<p>Click on the box below:</p>
<div @:click='writeText'>
{{ text }}
</div>
</div>
<script src="https://unpkg.com/vue@3/dist/vue.global.js"></script>
<script>
const app = Vue.createApp({
data() {
return {
text: ''
}
},
methods: {
writeText() {
this.text = 'Hello World!'
}
}
})
app.mount('#app')
</script>
<div id="app">
<p>Click on the box below:</p>
<div @:click="writeText">
{{ text }}
</div>
</div>
<script src="https://unpkg.com/vue@3/dist/vue.global.js"></script>
<script>
const app = Vue.createApp({
data() {
return {
text: ''
}
},
methods: {
writeText() {
this.text = 'Hello World!'
}
}
})
app.mount('#app')
</script>
Not CorrectClick here to try again. Correct!Next ❯ |
This will reset the score of ALL 54 exercises.
Are you sure you want to continue?