{// 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:"本人log快捷方式":{"prefix":"log","body":["console.log('$1',$1);"],"description":"Log output to console"},"ReactNative代码片段":{"prefix":"rn","body":["import {StyleSheet, Text, View} from 'react-native';","","export default function $1({navigation,route}) {","","\treturn (","\t\t<View>","\t\t\t<Text>$1</Text>","\t\t</View>","\t);","}","const styles = StyleSheet.create({","\tcontainer: {","\t\tflex: 1,","\t},","});"]},"fs":{"prefix":"fs","body":["//导入node的fs文件系统的模块","const fs = require(\"fs\")"],"description":"快速导入node模块"},"RN函数式组件快捷方式":{"prefix":"rnfs","body":["import React from 'react';","import { View, Text ,StyleSheet } from 'react-native';","","export default function $1 () {","\treturn (","\t\t<View>","\t\t\t<Text></Text>","\t\t</View>","\t);","}","","const styles = StyleSheet.create({})"],"description":"RN函数式组件快捷方式"},"huabu":{"prefix":"huabu","body":["const canvas = document.createElement(\"canvas\");","canvas.width = 600;","canvas.height = 400;","document.body.append(canvas);","const context = canvas.getContext(\"2d\");"]},"console.log":{"prefix":"log","body":["console.log('$1',$1);"],"description":"Log output to console"},"path":{"prefix":"path","body":["//导入node的path路径模块,__dirname表示当前文件所处的目录","const path = require(\"path\")"],"description":"快速导入node模块"},"moment":{"prefix":"moment","body":["//导入时间格式化的包","const moment = require(\"moment\")"],"description":"快速导入node模块"},"express":{"prefix":"express","body":["//导入express服务器第三方的包","const express = require(\"express\")","//解决跨域,导入中间件cors","const cors = require(\"cors\")","//创建服务器实例","const app=express()","//注册跨域中间件","app.use(cors())","//用来解析post请求体中的参数,把post请求的参数解析res.body","app.use(express.urlencoded({extended:false}))","","app.get(\"/\",function(req,res){","\tconsole.log(req.url,\"----查询字符串\");","\tconsole.log(req.method,\"----请求方式\");","\tconsole.log(req.query,\"----获取get请求参数\");","\tconsole.log(req.body,\"----获取post请求参数\");","\tconsole.log(req.headers,\"----请求头数据\");","\tconsole.log(res.send({code:1,msg:'信息'}),\"----响应数据\");","\tconsole.log(res.json({code:1,msg:'信息'}),\"----响应json数据,自动转换json\");","})","","app.post(\"/\",function(req,res){})","","//调用listen启动服务器","app.listen(80, function () {","\tconsole.log(\"开启了127.0.0.1服务器\");","})"],"description":"快速导入node模块"},"http":{"prefix":"http","body":["//导入web服务器http模块","const http = require(\"http\")","//创建web 服务器实例","const sever = http.createServer((req,res) => {","\tconsole.log(req.url);//前端网址","\tconsole.log(req.method);//请求方式","\tconsole.log(req.query);//获取到查询的字符串的数据","\tconsole.log(req.headers);//请求头对象","","\tres.write(\"hello world\");//只是写的,但是没响应","\tres.end();//代表响应结束","})","//为服务器实例绑定request事件,监听客户端的请求","sever.on(\"request\", function (req, res) {","\t//为了防止中文显示乱码的问题,需要设置响应头Content-Type的值为 text/html; charset=utf-8","\tres.setHeader('Content-Type', 'text/html; charset=utf-8')","\tconsole.log(\"正在请求地址http://127.0.0.1\");","})","//启动服务器,第一个参数代表端口号,第二个回调函数","sever.listen(80, function () {","\tconsole.log(\"开启 http://127.0.0.1 这个端口号\");","})"],"description":"快速导入node模块"},"parser":{"prefix":"parser","body":["//导入解析表单数据的中间件","const parser=require(\"body-parser\")"],"description":"快速导入node模块"},"querystring":{"prefix":"querystring","body":["//导入解析请求体数据的模块","const qs = require(\"querystring\")"],"description":"快速导入node模块"},"j":{"prefix":"j","body":["$(\"\")"],"description":"jq快速选择用$(' ')"},"mysql":{"prefix":"mysql","body":["//导入MySQL模块","const mysql=require(\"mysql\")","//建立与MySQL数据库的连接","const db=mysql.createPool({","\thost:\"127.0.0.1\", //数据库的IP地址","\tuser:\"root\", //登录数据库的账号","\tpassword:\"admin\", //登录数据库的密码","\tdatabase:\"数据库名\" //指定要操作哪个数据库","})","","//调用db.query()函数,指定要执行的SQL语句,通过回调函数拿到执行的结果","//result.affectedRows为影响的行数","db.query(\"sql语句\", function (err,results) {})"],"description":"快速导入node模块"},"express-session":{"prefix":"express-session","body":["//导入express-session中间件(先配置express包)","const session=require(\"express-session\")","//全局注册中间件","app.use(session({","\tsecret:\"xiaoji\",","\tresave:false,","\tsaveUninitialized:true,","}))"],"description":"快速导入node模块"},"Vue导入组件":{"prefix":"import","body":["import $1 from '@/components/$1.vue';"],"description":"Vue导入组件"},"cookiesession":{"prefix":"cookiesession","body":["//cookie-session中间件(先配置express包)","const cookiesession=require(\"cookie-session\")","app.use(cookiesession(","\t{","\t\t//在cookie中用户记录sessionid的名字","\t\tname: \"sessionid\",","\t\t//给sessionid一个加密的key,随便填写即可,但是必须要写,檫下键盘即可","\t\t//secret密钥,对明文进行加密处理","\t\tsecret: \"asdfbrtbonebmxmdk\",","\t\t//设置不活动session清除的时间","\t\tmaxAge: 20 * 60 * 1000, //20分钟","\t\t//让时间滚动刷新(每次浏览器刷新,时间重新计算,否则每次刷新时间都会延续)","\t\trolling: true,","\t}","))"],"description":"快速导入node模块"},"cookie":{"prefix":"cookie","body":["//导入cookie中间件(先配置express包)","const cookie = require(\"cookie-parser\")","//全局注册中间件","app.use(cookie())"],"description":"快速导入node模块"},"jwt":{"prefix":"jwt","body":["//导入用于生成JwT字符串的包(先配置express包)","const jwt = require(\"jsonwebtoken\")","//导入用于将客户端发送过来的JWT字符串,解析还原成JSON对象的包","const expressJWT =require(\"express-jwt\")","//定义密钥:secret密钥的本质:就是一个字符串,字符串的内容可以任意填写","const secretKey=\"wjcnwncownco\"","//将JWT字符串还原为JSON对象,先通过app.use()先注册","app.use(expressJWT({secret:secretKey}).unless({path:[/^\\/api\\//]}))"],"description":"快速导入node模块"},"urlencoded":{"prefix":"urlencoded","body":["//全局配置请求中urlencoded的解析中间件","app.use(express.urlencoded({ extended: false }))"],"description":"快速导入node模块"},"app_":{"prefix":"app_","body":["app_id=pevirmtrnrnhxdfo&app_secret=MGRFTVJ4YjdqSnhYRWtPWEVCV3JlUT09"],"description":"个人ajax的api码"},"fori":{"prefix":"fori","body":["for(let i=0;i<10;i++){","","}"],"description":"for循环快捷代码1"},"forz":{"prefix":"forz","body":["for(let z=0;z<10;z++){","","}"],"description":"for循环快捷代码2"},"fora":{"prefix":"fora","body":["for(let a=0;a<10;a++){","","}"],"description":"for循环快捷代码3"},"require":{"prefix":"require","body":["//导入模块","const mdA = require(\"./moduleA\")"],"description":"导入模块"},"exoports":{"prefix":"exoports","body":["//导出模块","module.exports"],"description":"导出模块"},"axios":{"prefix":"axios","body":["//axios的get请求","axios.get(\"\").then(function(data){},function(error){})","//axios的post请求","axios.post(\"\",{}).then(function(data){},function(error){})"],"description":"导出模块"},"mongoDB":{"prefix":"mongoDb","body":["const mongoose = require('mongoose');","// 设置要连接的 MongoDB 服务器地址(studentsManage:要连接的数据库名称)","const dbURI = 'mongodb://localhost:27017/这里换自己数据库名';","// 连接数据库","mongoose.connect(dbURI, { useNewUrlParser: true, useUnifiedTopology: true });","//当数据库连接成功时触发此事件","mongoose.connection.on('connected', () => console.log(dbURI + ' 数据库连接成功'));","","//Schema这个方法是一个构造函数,通过new创建这个构造方法的实例对象","// 这个方法用于定义数据库列名和值的类型","// 1.定义数据集合的结构:定义出集合中数据有哪些属性,属性的值是什么类型。","const usersSchema = new mongoose.Schema({","\tusername:String,","\tpassword:Number","//后面以此类推定义列名和列的值类型","})","","//2.定义数据集合的模型,将Schema和数据库中的集合关联起来","//model参数一:模型名称","//参数二:为上面的usersSchema","//参数三:数据库中的集合名称","const usersModel=mongoose.model('usersmodel',usersSchema,'users')"]},//以下为autojs相关片段"autojs弹出层":{"prefix":"toast","body":["toast($1)"],"description":"autojs"},"autojs等待时间":{"prefix":"sleep","body":["sleep($1)"],"description":"autojs"},"autojs检测文本信息":{"prefix":"text","body":["text($1)"],"description":"autojs"},"autojs等待满足条件":{"prefix":"waitfor","body":["waitFor()"],"description":"autojs"},"autojs的界面引入":{"prefix":"ui","body":["\"ui\";","ui.layout(","\t<vertical>","\t\t1","\t</vertical>",")"],"description":"autojs"},"autojs点击":{"prefix":"click","body":["click(x,y)"],"description":"autojs"},"autojs长按":{"prefix":"longClick","body":["longClick(x, y$1)"],"description":"autojs"},"autojs长按带按下时间":{"prefix":"press","body":["press(x, y, time$1)"],"description":"autojs"},"autojs的滑动":{"prefix":"swipe","body":["swipe(x1, y1, x2, y2, duration$1)"],"description":"autojs"},"autojs的多点手势滑动":{"prefix":"gesture","body":["gesture(duration, [x1, y1], [x2, y2], ...) //参数一:时长,后面的参数为滑动的每个点的坐标"],"description":"autojs"},"autojs获取设备信息宽":{"prefix":"device.w","body":["device.width"],"description":"autojs"},"autojs获取设备信息高":{"prefix":"device.h","body":["device.height"],"description":"autojs"},"electron引入":{"prefix":"elec","body":["const { app, BrowserWindow } = require(\"electron\");","","const createWindow = () => {","\tconst win = new BrowserWindow({","\t\twidth: 800,","\t\theight: 600,","\t});","\twin.loadFile(\"index.html\");","","\twin.on(\"close\", () => {","\t\tconsole.log(\"当前窗口关闭\");","\t});","};","app.whenReady().then(() => {","\tcreateWindow();","});","app.on(\"window-all-closed\", () => {","\tconsole.log(\"所有窗口关闭\");","\tapp.quit();","});"],"description":"autojs"},"react的类组件创建":{"prefix":"classreact","body":["class $1 extends React.Component {","\trender () {","\t\treturn (<div></div>)","\t}","}"],"description":"react的类组件创建"}}
sql模板设置
{
"zsgc": {
"prefix": "zsgc","body": ["-- 有个users表 四个字段id username password status,四个字段代表四列,其中id为自增列,status默认值为0,可选值0,1","-- id自增,username分别为zs,ls,wu password分别为:123456 abcdef 123abc status为0,1,1","-- 查询整张表的所有数据","-- select * from users","-- 查询指定列的所有数据","-- select username,password from users","-- 指定某列添加数据","-- insert into users(username,password) values('萧寂','1234')","-- 指定某列修改数据","-- update users set username=\"你好a\",password=\"1234567\",status=1 where id=2","-- 根据id删除行","-- delete from users where id=4","-- 查询status为1的所有用户","-- SELECT *FROM users WHERE status=1","-- 查询id大于2的所有用户","-- SELECT *FROM users WHERE id>2","-- 查询username不等于admin的所有用户","-- SELECT *FROM users WHERE username<>'admin'","-- 使用AND来显示所有status为0,并且id 小于3的用户:","-- SELECT * FROM users WHERE status=0 AND id<3","-- 使用OR来显示所有status为1,或者username为zs的用户","-- SELECT* FROM users WHERE status=1 OR username='zs'","-- 对users表中的数据,按照status字段进行升序排序","-- SELECT * FROM users ORDER BY status;(升序排序在status后加上ASC效果等同)","-- select * from users order by status asc","-- 根据id降序排序,降序排序使用desc关键字","-- select * from users order by id desc","-- 多重排序 对users 表中的数据,先按照status字段进行降序排序,再按照username的字母顺序,进行升序排序","-- SELECT * FROM users ORDER BY status DESC,username asc","-- 查询id为1的数据返回的总条数","-- select count(*) from users where id=1","-- 将列名称从COUNT(*)修改为total","-- SELECT COUNT(*) AS total FROM users WHERE id=1","-- 给username列添加uname别名,给password列添加upwd别名","-- select username as uname,password as upwd from users",],"description": "Log output to console"
}
}
Vue模版设置
{// 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"// }"Vue2单文件组件模板":{"prefix":"v2","body":["<template>","\t<div class=\"$1\">","\t\t","\t</div>","</template>","","<script>","export default {","\tname:'$1'","}","</script>","","<style scoped lang=\"scss\">","","</style>"],"description":"Vue单文件组件模板"},"vue3单文件组件模板":{"prefix":"v3","body":["<script setup>","","import { ref, reactive } from 'vue';","const count = ref(0);","","</script>","","<template>","\t<div class=\"$1\">","\t\t","\t</div>","</template>","","<style scoped lang=\"scss\">","","</style>"],"description":"Vue3单文件组件模板"}}