Vue · Middle · Question 17 of 75
What does defineExpose do in <script setup>?
- ✓Correct answer: Makes selected properties available to a parent that holds a template ref to the component
- 2Exports the component as an npm package
- 3Exposes the component's state to devtools only
Explanation
<script setup> components are closed by default: a parent's ref gets nothing. defineExpose({ focus }) lets the parent call childRef.value.focus().