此方法仅适用于vscode
1、首先打开快捷键 ctrl + shift +p 打开全局搜索
2、选择preferences:configure user snippets
选择之后,继续选择js或者vue文件对应json
3、若是选择js.json,复制如下代码到js.json
{
"Print to jsNoteTitle": {
"prefix": "jsNoteTitle",
"body": [
"/*",
" *@description:",
" *@author: pmb",
" *@date: ${CURRENT_YEAR}-${CURRENT_MONTH}-${CURRENT_DATE} ${CURRENT_HOUR}:${CURRENT_MINUTE}:${CURRENT_SECOND}",
" *@version: V1.0.5",
"*/"
],
"description": ""
},
"Print to jsfn": {
"prefix": "jsfn",
"body": [
"/*",
" *@functionName: ${TM_CURRENT_LINE}",
" *@params1: ${1:参数1}",
" *@params2: ${2:参数2}",
" *@params3: ${3:参数3}",
" *@params4: ${4:参数4}",
" *@description:",
" *@author: pmb",
" *@date: ${CURRENT_YEAR}-${CURRENT_MONTH}-${CURRENT_DATE} ${CURRENT_HOUR}:${CURRENT_MINUTE}:${CURRENT_SECOND}",
" *@version: V1.0.5",
"*/"
],
"description": ""
},
"Print to jsModify": {
"prefix": "jsModify",
"body": [
"/*",
" *@description:",
" *@modifyContent:",
" *@author: pmb",
" *@date: ${CURRENT_YEAR}-${CURRENT_MONTH}-${CURRENT_DATE} ${CURRENT_HOUR}:${CURRENT_MINUTE}:${CURRENT_SECOND}",
"*/"
],
"description": ""
},
"Print to jsVariable": {
"prefix": "jsVariable",
"body": [
"/*",
" *@description:",
" *@author: pmb",
" *@date: ${CURRENT_YEAR}-${CURRENT_MONTH}-${CURRENT_DATE} ${CURRENT_HOUR}:${CURRENT_MINUTE}:${CURRENT_SECOND}",
" *@variable1: ${1:变量1}",
" *@variable2: ${2:变量2}",
" *@variable3: ${3:变量3}",
" *@variable4: ${4:变量4}",
" *@variable5: ${5:变量5}",
"*/"
],
"description": ""
},
}
若是vue文件,vue.json,复制如下代码
{
"Print to vueTitle": {
"prefix": "vueTitle",
"body": [
"<!-- ",
" * @description: ",
" * @fileName: ${TM_FILENAME} ",
" * @author: pmb ",
" * @date: ${CURRENT_YEAR}-${CURRENT_MONTH}-${CURRENT_DATE} ${CURRENT_HOUR}:${CURRENT_MINUTE}:${CURRENT_SECOND} ",
" * @后台人员: $1 ",
" * @path: $2 ",
" * @version: V1.0.5 ",
"!-->"
],
"description": ""
}
}
4、效果图
index.vue