1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

VSCodeで使えるNuxt ×TypeScript × CompositionAPIの便利スニペッツ

Last updated at Posted at 2020-11-13

VSCode上でNuxt,TypeScript,CompositionAPIで開発するときに毎回同じ内容を書くのが面倒だなと思ったのでスニペットを作ってみました。
VSCodeで新規ファイルを作成後、ファイル内でnuxt3+ts templateを打つとこのスニペッツが出てくるので、それを選択すれば以下のコードが自動的に生成されます。(おそらくnuxtを打っただけで補完が効くと思います)。
内容としては、<template><script lang="ts"><style scoped>タグやdefineComponentのimportと定型文を設定しています。
誰かの参考になれば幸いです:)

vue.json
{
	"nuxt3+ts template": {
		"prefix": "nuxt3+ts template",
		"body": [
			"<template>",
			"",
			"</template>",
			"",
			"<script lang=\"ts\">",
			"import { defineComponent } from '@nuxtjs/composition-api'",
			"export default defineComponent({",
			"  name: '$1',",
			"  setup(){}",
			"})",
			"</script>",
			"",
			"<style scoped></style>"
		]
	}
}
1
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?