乐趣区

如何使用vscode快速新建vue模版

  1. 文件 ==> 首选项 ==> 用户代码片段 ==> 输入 vue 然后回车
  2. 添加配置,让 vscode 允许自定义的代码片段提示出来
 
{
    "Print to console": {
        "prefix": "vue",
        "body": [
            "<template>",
            "<div>",
            "$0",
            "</div>",
            "</template>",
            "","<script>","",
            "export default {",
            "name:'',","    props:[''],",
            "data () {",
            "return {",
            "","      };","    },","",
            "components: {},",
            "","    computed: {},","",
            "beforeMount() {},",
            "","    mounted() {},","",
            "methods: {},",
            "","    watch: {}","",
            "}",
            "","</script>","<style lang=''scoped>",
            "","</style>"],"description":"Log output to console"
    }
}
  1. 测试方法:新建 vue 后缀文件,输入 vue,按下 tab 键,OK
退出移动版