代码片段
作用
可以自定义自己常用的代码,在日后写代码时更方便快捷
使用
设置中打开
自定义代码片段的名字
举例
我的常用代码片段 ( 努力更新ing )
one
axios try catch
"async await":{
"scope": "javascript,typescript",
"prefix": "atc",
"body": [
"async $1($3) {",
"try {",
"const res = await $2($3)",
"console.log('$2', res)",
"$4",
"} catch (error) {",
"console.log('$2',error)",
"}",
"}"
],
"description": "tcaa"
}
复制代码
two
提示框
"$confirm":{
"scope": "javascript,typescript",
"prefix": "$ctc",
"body": [
"this.confirm('Sure?', 'Tips', {",
"confirmButtonText: 'YES',",
"cancelButtonText: 'NO',",
"type: 'warning'",
"}).then(() => {",
"$1",
"}).catch(() => {",
"$2",
"})"
],
"description": "confirm then catch"
}
复制代码
three
...
复制代码
© 版权声明
文章版权归作者所有,未经允许请勿转载。
THE END