sdras/vue-vscode-snippets

Hope to optimize the support of the composition api, which can return at the same time when I define the variables or functions.

chengpeiquan opened this issue · 1 comments

Hi, sdras!

At last month, Vue 3.0 was released, I using Vue 3.0 with the Composition Api and TypeScript now.

This vscode plugin is very good! But I encountered a little problem in the process of using.

example:

I can use this command ts to quickly create a Vue component.It's very convenient!

<template>
  <div>

  </div>
</template>

<script lang="ts">
import { defineComponent } from 'vue'

export default defineComponent({
  setup () {
    

    return {}
  }
})
</script>

<style scoped>

</style>

Then, if I want to start using the composition api to create some data or functions, follow the official specification, I must first define the variable and then return it to use.

The current problem is that through some shortcut commands, such as v3reactive, I can quickly create a variable, but cannot return it synchronously.

example:

import { defineComponent } from 'vue'

export default defineComponent({
  setup () {
    const name = reactive({
      count: 0
    })

    return {}
  }
})

I hope to help developers return these data synchronously when defining variables or functions.

Thank you very much!

Yeah, Now I can use script-setup to solve my needs.