Vue3 Created Setup

Posted on  by admin
In this Vue tutorial we learn an easier way to use the Composition API in components with the script setup.

We cover the lack of config object, how to use components, props and events and event data. How to send events with the script setup. If you want to follow along with the examples, you will need to create an app generated by the Vue CLIas well as the following extra component.

The project should look similar to the following. TheGreetingMessagecomponent will have a paragraph with a simple greeting. The script setup is a different way for us to use the Composition API in components. Basically, we don’t need to use the config object and itssetupoption.

Clifton LabrumClifton Labrum

As an example, let’s consider the following. In the example above, we need the config object, thesetupoption and we need to return the “name” ref from it to be used in the template.

What is the script setup?


Not the answer you're looking for? Browse other questions tagged javascriptvue.jsvuejs3vue-composition-api or ask your own question.