Question · Vue.js course · Module 2: Template Syntax
Same-name Shorthand :attr (Vue 3.4+)
What does <img :src> without a value mean when a src variable exists in <script setup>?
Answer options
- The same as :src="src" - a binding to the variable with the same name
- The src attribute is removed from the element
- A compilation error - v-bind always needs a value
- The src attribute gets the value true
Show the answer
Correct answer:
- The same as :src="src" - a binding to the variable with the same name