Vue SFC Script Setup
<script setup> is a compile-time syntactic sugar for using Composition API inside Single-File Components (SFCs). It is the recommended syntax if you are using both SFCs and Composition API.
Basic Syntax
To opt-in to the syntax, add the setup attribute to the <script> block:
<script setup>
console.log('hello script setup')
</script>The code inside is compiled as the content of the component’s setup() function. This means that unlike normal <script>, which only executes once when the component is first imported, code inside <script setup> will execute every time an instance of the component is created.