vue3 を直接入力してテンプレート コード スニペットを生成しますか? 今日それが来ました
vscode の左下隅にある小さな歯車設定ボタンを開き、ユーザー コード スニペットを選択します。
一部は中国語で書かれている場合があります。
次に、vue.json を検索し、次の json コードをそこにコピーします。
{
// Place your snippets for vue here. Each snippet is defined under a snippet name and has a prefix, body and
// description. The prefix is what is used to trigger the snippet and the body will be expanded and inserted. Possible variables are:
// $1, $2 for tab stops, $0 for the final cursor position, and ${1:label}, ${2:another} for placeholders. Placeholders with the
// same ids are connected.
// Example:
"Print to console": {
"prefix": "vue3",
"body": [
"<template>",
"<div>",
"",
"</div>",
"</template>",
"",
"<script setup lang='ts'>",
"import { ref, reactive } from 'vue'",
"",
"</script>",
"",
"<style scoped>",
"",
"</style>"
],
"description": "Log output to console"
}
}
次に、保存して vue ファイルを再度開き、「vue3」と入力します。プロンプトが表示され、Enter キーを押します。