1.安装SublimeTmpl插件
打开package control,输入“install package”,然后回车
输入"SublimeTmpl",然后回车
这样就安装好了SublimeTmpl插件
2.设置SublimeTmpl插件
安装好后,还需要对插件进行设置一下。
打开C:\Users\windows\AppData\Roaming\Sublime Text\Packages\SublimeTmpl\templates目录,在该目录下新建vue.tmpl,内容如下:
<script setup>
</script>
<template>
</template>
<style scoped>
</style>
</script>
<template>
</template>
<style scoped>
</style>
打开Package Settings->SublimeTmpl->Commands-Default添加如下配置:
{
"caption":"Tmpl:Create vue","command":"sublime_tmpl",
"args":{"type":"vue"}
}
"caption":"Tmpl:Create vue","command":"sublime_tmpl",
"args":{"type":"vue"}
}
打开Package Settings->SublimeTmpl->Key Bindings-Default添加如下配置:
{
"keys":["ctrl+alt+e"],"command":"sublime_tmpl",
"args":{"type":"vue"},"context":[{"key":"sublime_tmpl.vue"}]
}
"keys":["ctrl+alt+e"],"command":"sublime_tmpl",
"args":{"type":"vue"},"context":[{"key":"sublime_tmpl.vue"}]
}
打开Package Settings->SublimeTmpl->Menu-Default添加如下配置:
{
"id": "vue",
"caption": "vue",
"command": "sublime_tmpl",
"args": {
"type": "vue"
}
}
"id": "vue",
"caption": "vue",
"command": "sublime_tmpl",
"args": {
"type": "vue"
}
}
在项目文件夹上点击右键,找到New File(SublimeTmpl)下面的Side Bar Menu - Default添加如下配置:
{
"id": "vue",
"caption": "vue",
"command": "sublime_tmpl",
"args": {
"type": "vue",
"paths": [],
}
}
"id": "vue",
"caption": "vue",
"command": "sublime_tmpl",
"args": {
"type": "vue",
"paths": [],
}
}
然后你就可以通过文件下面的New File(SublimeTmpl)快速创建vue模板了,或者通过Ctrl+Alt+E快捷键来创建