文件–>首选项—>用户代码段
vue.json文件
{
// Place your snippets for vue here. Each snippet is defined under a snippet name and has a prefix, body and
// description. The prefix is what is used to trigger the snippet and the body will be expanded and inserted. Possible variables are:
// $1, $2 for tab stops, $0 for the final cursor position, and ${1:label}, ${2:another} for placeholders. Placeholders with the
// same ids are connected.
// Example:
// "Print to console": {
// "prefix": "log",
// "body": [
// "console.log('$1');",
// "$2"
// ],
// "description": "Log output to console"
// }
"Print to console": {
"prefix": "sc",
"body": [
"<template>",
" ",
" ",
"</template>",
"<script>",
"export default {",
" ",
" ",
"}",
"</script>",
"<style>",
" ",
" ",
"</style>"
],
"description": "Log output to console"
}
}
javascript.json
{
// Place your snippets for JavaScript here. Each snippet is defined under a snippet name and has a prefix, body and
// description. The prefix is what is used to trigger the snippet and the body will be expanded and inserted. Possible variables are:
// $1, $2 for tab stops, $0 for the final cursor position, and ${1:label}, ${2:another} for placeholders. Placeholders with the
// same ids are connected.
// Example:
"Print to console": {
"prefix": "log",
"body": [
"console.log('$1');",
],
"description": "Log output to console"
},
"jquery to ajax": {
"prefix": "ajax",
"body": [
"$.ajax({",
"url:'',",
"type:'get',",
"dataType:'json',",
"data:'',",
"success: function(data){",
"}",
"});"
],
"description": "ajax请求"
},
"form to ajax": {
"prefix": "form-ajax",
"body": [
"$('#form').on('submit',function(e){",
"//禁用表单默认提交事件",
"e.preventDefault();",
"$.ajax({",
"url:'',",
"type:'get',",
"dataType:'json',",
"data:'',",
"success: function(data){",
"}",
"});",
"});"
],
"description": "表单提交ajax请求"
},
"express-server": {
"prefix": "express",
"body": [
"//1.导入模块",
"const express = require('express');",
"//2.创建服务器",
"let app = express();",
"//3.开启服务器",
"app.listen(3000,()=>{",
"console.log('success');",
"});"
],
"description": "快速搭建express服务器"
},
"get element by id": {
"prefix": "gid",
"body": [
"var box = document.getElementById('box')",
],
"description": "根据id获取元素"
},
"enmu arr": {
"prefix": "forin",
"body": [
"for(var i = 0;i<arr.length;i++){",
"console.log(arr[i]);",
"}",
],
"description": "数组快速for循环遍历"
},
"get elment by tagname": {
"prefix": "gtn",
"body": [
"var liList = document.getElementsByTagName('li')",
],
"description": "根据标签名获取元素"
},
"get elment by classname": {
"prefix": "gcn",
"body": [
"var oneList = document.getElementsByClassName('one')",
],
"description": "根据类名获取元素"
},
"quick event": {
"prefix": "click",
"body": [
"//注册事件",
"box.onclick = function(){}",
],
"description": "快速注册点击事件"
},
"需求分析": {
"prefix": "silu1",
"body": [
"/*",
"1.分析需求(交互):",
"2.思路分析(事件三要素)",
"获取元素:事件源:",
"注册事件:事件类型",
"事件处理:",
"*/",
],
"description": "分析需求"
},
"根据思路实现需求": {
"prefix": "silu2",
"body": [
"//1.获取元素",
"var box = document.getElementById('box');",
"//2.注册事件",
"box.onclick = function () {",
"//3.事件处理:",
"};",
],
"description": "根据思路实现需求"
},
}