Skip to content

Using Script Setup for Vue 3

Featured Image

I am text block. Click edit button to change this text. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Ut elit tellus, luctus nec ullamcorper mattis, pulvinar dapibus leo.

Key difference between <script setup> and <script>

Using Components

code(Image — 1) Use the components with <script setup>

Top-level bindings exposed to template

code(Image — 2) The top-level bindings exposed to the template while using <script setup>

Using Recursive Components

code (Image — 3) Recursive component with <script setup>

code

 (Image — 4) Recursive component with <script setup>

Using Dynamic Components

code

(Image — 5) Dynamic component demo with <script setup>

Using Lifecycle Hooks

code

(Image — 6) Using lifecycle hook inside <script setup>

code

Reactivity

code

   (Image — 7) Reactivity demo with <script setup>

Using Emits

code

(Image — 8) Using emits with <script setup>

 

code

(Image — 9) Using emits with <script setup>

Using Props

code

(Image — 10) Using pops with <script setup>

 

code(Image — 11) create Vue project with Vite

 

code(Image — 12) ESLint configuration to fix no-undef error

Reacting to Changes with watch

code

 (Image — 13) Using watch with <script setup>

Using normal <script> with <script setup>

 

code

(Image — 15) Using <script> with <script setup>

code(Image — 16) Using <script> with <script setup>

Related Insights