Describe Problem
Hello Ionic team! 😄
Most, if not all, of the current Vue code snippets are written in a verbose way.
<template>
<ion-page>
<ion-header>
<ion-toolbar>
<ion-title>Details</ion-title>
</ion-toolbar>
</ion-header>
<ion-content> Detail ID: {{ id }} </ion-content>
</ion-page>
</template>
<script lang="ts">import { IonContent, IonHeader, IonPage, IonTitle, IonToolbar } from'@ionic/vue';import { defineComponent } from'vue';import { useRoute } from'vue-router';exportdefaultdefineComponent({ name: 'Detail', components: {IonContent,IonHeader,IonPage,IonTitle,IonToolbar, }, setup() {const route =useRoute();const { id } =route.params;return { id }; }, });</script>Describe Preferred Solution
Vue 3 offers <script setup> a compile-time syntactic sugar which allows for more succinct code with less boilerplate. The above piece of code could be simplified as follows.
<template>
<ion-page>
<ion-header>
<ion-toolbar>
<ion-title>Details</ion-title>
</ion-toolbar>
</ion-header>
<ion-content> Detail ID: {{ id }} </ion-content>
</ion-page>
</template>
<script setup lang="ts">import { IonContent, IonHeader, IonPage, IonTitle, IonToolbar } from'@ionic/vue';import { defineComponent } from'vue';import { useRoute } from'vue-router';const route =useRoute();const { id } =route.params;</script>Describe Alternatives
It is also possible to re-arrange the order of the tags to make the code snippet more readable.
<script setup lang="ts">import { IonContent, IonHeader, IonPage, IonTitle, IonToolbar } from'@ionic/vue';import { defineComponent } from'vue';import { useRoute } from'vue-router';const route =useRoute();const { id } =route.params;</script>
<template>
<ion-page>
<ion-header>
<ion-toolbar>
<ion-title>Details</ion-title>
</ion-toolbar>
</ion-header>
<ion-content> Detail ID: {{ id }} </ion-content>
</ion-page>
</template>Additional Information
I would like to offer my help to refactor said code snippets in case this feature request is approved 😄
Describe Problem
Hello Ionic team! 😄
Most, if not all, of the current Vue code snippets are written in a verbose way.
Describe Preferred Solution
Vue 3 offers
<script setup>a compile-time syntactic sugar which allows for more succinct code with less boilerplate. The above piece of code could be simplified as follows.Describe Alternatives
It is also possible to re-arrange the order of the tags to make the code snippet more readable.
Additional Information
I would like to offer my help to refactor said code snippets in case this feature request is approved 😄