VScode 使用 Snippets

创建模板脚本

  1. 通过Ctrl+P触发命令行输入
>snippets

  1. 选择"配置用户代码片段",选择对应的项目,以及文件名称。

  2. 这里创造一个vue页面模板:

"Add new template of vue": {
    "prefix": "new vue template",
    "body": [
      "<template>",
      "\t<div>",
      "",
      "\t</div>",
      "</template>",
      "<script>",
      "\timport { Component, Vue, Prop, Ref, Watch} from \"vue-property-decorator\"",
      "\timport { State, Action } from \"vuex-class\"",
      "\t@Component({",
      "\t\tname:'${TM_FILENAME/(.*)\\..+$/$1/}',",
      "\t\tcomponents: {}",
      "\t})",
      "\texport default class ${TM_FILENAME/(.*)\\..+$/$1/} extends Vue {",
      "\t",
      "\t}",
      "</script>",
      "<style lang=\"less\" scoped></style>"
    ],
    "description": "create new vue template"

  },


选择刚刚创建的模板,产生对应的代码:

posted @   ChrisLeon  阅读(119)  评论(0编辑  收藏  举报
相关博文:
阅读排行:
· 阿里最新开源QwQ-32B,效果媲美deepseek-r1满血版,部署成本又又又降低了!
· 开源Multi-agent AI智能体框架aevatar.ai,欢迎大家贡献代码
· Manus重磅发布:全球首款通用AI代理技术深度解析与实战指南
· 被坑几百块钱后,我竟然真的恢复了删除的微信聊天记录!
· 没有Manus邀请码?试试免邀请码的MGX或者开源的OpenManus吧
点击右上角即可分享
微信分享提示
主题色彩