集成的Git、调试、扩展的免费开源编程软件 Microsoft在2015年4月30日Build 开发者大会上正式宣布了 Visual Studio Code 项目:一个运行于 Mac OS X、Windows和 Linux 之上的,针对于编写现代 Web 和云应用的跨平台源代码编辑器
javascriptreact.json
{
"map快速遍历模板": {
"prefix": "map",
"body": [
"{",
"[",
"{$1}",
"].map((item, index) => {",
"return $2",
"})}"
],
"description": "map快速遍历模板"
},
"打印输出": {
"prefix": "log",
"body": [
"console.log($1,`打印输出$2`)",
],
"description": "打印输出"
},
"路由参数跳转页面": {
"prefix": "tiaozhuan-thispropshistory",
"body": [
"this.props.history.push(`/Dashboard/${activeKey}$1?id=${e.id }`);",
],
"description": "路由参数跳转页面"
},
"返回页面": {
"prefix": "tiaozhuan-history.go(-1) ",
"body": [
"window.app.router.goBack()",
],
"description": "返回页面"
},
"跳转导出": {
"prefix": "tiaozhuan-window.open()",
"body": [
"window.open(`${CDN_BASE}公告对象模板.xlsx`)",
],
"description": "跳转导出"
},
"React更新视图": {
"prefix": "thissetstate",
"body": [
"this.setState({",
"$1",
"})",
],
"description": "React更新视图"
},
"快速生成enum": {
"prefix": "enum",
"body": [
"emum:{",
"0:\"$1\",",
"1:\"$2\",",
"2:\"$3\",",
"3:\"$4\",",
"},",
],
"description": "快速生成enum"
},
"快速生成表单中Select等的data": {
"prefix": "data",
"body": [
"data:[",
" {value:\"$1\" ,label:\"$1\"},",
" {value:\"$2\" ,label:\"$2\"},",
" {value:\"$3\" ,label:\"$3\"},",
"],",
],
"description": "快速生成data"
},
"解构ant form": {
"prefix": "thispropsform",
"body": [
"const { form: { getFieldDecorator, getFieldValue, getFieldsValue, getFieldsError, resetFields, validateFields,validateFieldsAndScroll, setFieldsValue, setFields } } = this.props",
"$1"
],
"description": "ant pro 表单的api方法"
},
"解构mobx的AppStore": {
"prefix": "thispropsAppStore",
"body": [
" const { searchparams, isLoaded, hookCbf, routerCfg } = this.props.AppStore.state",
"$1"
],
"description": "ant pro 表单的api方法"
},
"提交函数": {
"prefix": "bind",
"body": [
"{this.handleSubmit$1.bind(this)}",
],
"description": "提交函数"
},
"ant提交时候校验": {
"prefix": "handleSubmit",
"body": [
"handleSubmit() {",
"const { form: { validateFields } } = this.props",
"validateFields(async (err, values) => {",
" console.log(values, \"————————这是提交时候的values值————————\");",
"if (err) { return }",
"let { customs, ...other } = values",
"let newData = other",
"let { resultMsg, resultCode, data } = await request.save(",
" { ...newData }",
")",
"if (resultCode == '0') {",
"message.success(\"已保存\")",
"this.setState({",
"isShowModel: false,",
"version: Math.random()",
"})",
" } else {",
" message.error(\"操作错误\")",
" }",
"})",
"}",
],
"description": "ant提交时候校验"
},
"详情查询数据": {
"prefix": "chaxun",
"body": [
"this.queryPageNeedData()",
"async queryPageNeedData() {",
"let { resultMsg, resultCode, data",
"} = await request.queryByRecallOrderNo({",
" recallOrderNo: this.id,",
"})",
" if (resultCode == '0') {",
"const { form: { setFieldsValue, setFields",
"}",
"} = this.props",
"setFieldsValue({ QA: data",
"})",
" // this.setState({",
"// isShowModel: false,",
"// version: Math.random()",
"// })",
"} else {",
" message.error(\"查询错误\")",
"}",
"}",
],
"description": "详情查询数据"
},
"antd中的form结合row使用": {
"prefix": "formrow",
"body": [
"{/*",
"const {Item:FormItem} = Form",
"const formItemLayout = {",
"labelCol: {span: 6 },",
"wrapperCol: {span: 18 },",
"};*/}",
"",
"<Form {...formItemLayout}>",
"<Row gutter={32}>",
" <Col span={12}>",
"<FormItem label=\"$1\">",
"{getFieldDecorator('$2', {",
"rules: [",
" {",
" required: true,",
" message: '$1不能为空',",
" },",
" {",
" max: 50,",
" message: '$1的字符不能超过50个字符',",
"},",
" ],",
" })(",
"<Input$3 />",
")}",
"</FormItem>",
"</Col>",
"$4",
"$3",
" </Row>",
" </Form>",
],
"description": "antd中的form结合row使用"
},
"FormItem 每一项": {
"prefix": "formcol",
"body": [
" <Col span={12}>",
"<FormItem label=\"$1\">",
"{getFieldDecorator('$2', {",
"//normalize: this.normalizeAllPositiveInteger,",
"rules: [",
" {",
" required: true,",
" message: '$1不能为空',",
" },",
" {",
" max: 50,",
" message: '$1的字符不能超过50个字符',",
"},",
" ],",
" })(",
"<Input$3 />",
")}",
"</FormItem>",
"</Col>",
"$4",
],
"description": "FormItem 每一项"
},
"解构React State": {
"prefix": "thisstate",
"body": [
"const { isShowModal,$1 } = this.state",
"$2"
],
"description": "解构React State"
},
"解构React Props": {
"prefix": "thisprops",
"body": [
"const { $1 } = this.props",
"$2"
],
"description": "解构React Props"
},
"快速导入Select的Option": {
"prefix": "antselect",
"body": [
"const { Option: SelectOption} = Select",
"$1"
],
"description": "快速导入Select的Option"
},
// ———————————— 云徙常用 ————————————
"yx 常用表单元素": {
"prefix": "yxformelement",
"body": [
"{",
" type: \"String$3\",",
" controlItemParam: {",
" id: `id$2`,",
" label: `$1`,",
" placeholder: `请输入`,",
" // placeholder: ['开始时间', '结束时间'],",
" // type:`range`,",
" // labelLength:11,",
" // rules:{ required: false, max: 11 },",
" // inputParam:{ maxLength: 11 },",
" },",
"},",
"$5",
],
"description": "yx 常用表单元素"
},
"yx导出": {
"prefix": "daochu-action",
"body": [
"{",
"text: \"导出\",",
"actionType: \"action\",",
"isConfirm: false,",
"check: false,",
"type: \"primary\",",
"onClick: async (data) => {",
"console.log(data,\"data\");",
"data.pageSize = 2000;",
"let res = await request.exportData({$1});",
"if(res.resultCode == 0){",
"//window.open(res.data,\"_blank\");",
"utils.downloadFiles(`\\${CDN_BASE}公告对象模板.xlsx`, \"公告对象模板.xlsx\")",
"}",
"},",
"},",
],
"description": "yx导出"
},
"yx优化下载文件": {
"prefix": "xiazai-downloadFiles",
"body": [
"utils.downloadFiles(`\\${CDN_BASE}公告对象模板.xlsx`, \"公告对象模板.xlsx\")",
],
"description": "yx优化导出"
},
"yx导出的api": {
"prefix": "daochu-api",
"body": [
"// 导出数据",
"static exportData(params={}) {",
"return request({",
"url: `$1/export`,",
"method: 'post',",
"//params,",
"data: params,",
"headers: { 'Content-type': 'application/json' }",
" })",
"}",
"$2"
],
"description": "使用put请求api接口"
},
"yx导入": {
"prefix": "daoru-action",
"body": [
"{",
"actionType: 'upload',",
"text: \"导入\",",
"isConfirm: false,",
"check: false,",
"loading: this.state.importLoading,",
"uploadConfig: config.uploadConfig,",
"// uploadConfig: {",
"// url: `${config.BACKEND_BASE}/v1/${apis.getPolicyUrl}`,",
"// AccessToken: config.uploadConfig.AccessToken",
"// },",
"type: \"primary\",",
"inputParam: {",
"type: 'file',",
"accept: '.xlsx,.xls'",
"},",
"requestParam: {",
"url: 'word/importWord',",
"method: 'post',",
"message: false,",
"beforeRequest: (data) => {",
"return {",
"fileUrl: data.fileUrl[0],",
" value: 0,",
"name: Date.now(),",
"type: this.state.key === \"1\" ? \"1\" : \"0\"",
"}",
" },",
" // 请求成功的回调",
" callback: (res) => {",
"message.success(\"导入成功\");",
"queryList = setInterval(() => {",
"let { version } = this.state;",
"version++",
"this.setState({",
"version: version",
"})",
"}, 20000)",
" },",
"// 请求失败的回调",
"failure: (res) => {",
"if (res.data) {",
"console.log(\"上传失败\");",
" } else {",
" message.error('导入失败,' + res.resultMsg);",
" }",
"},",
"}",
"},",
],
"description": "yx导入"
},
"yx删除": {
"prefix": "shanchu-action-onClick",
"body": [
"onClick: async (rowData) => {",
"let { resultMsg, resultCode,data } = await request.invalidCoupon({",
"id: rowData.id,",
"status:1,",
"})",
"if (resultCode == '0') {",
"message.success(\"已失效\")",
"this.setState({",
"isShowModel: false,",
"version: Math.random()",
"})",
"}else{",
"message.error(\"操作错误\")",
" }",
"},",
],
"description": "yx删除"
},
"yx动作action过滤1": {
"prefix": "filter1",
"body": [
"filter: { dataIndex: \"$1\", contains: [$2] },",
"$3"
],
"description": "yx动作action过滤1"
},
"yx动作action过滤2【函数】": {
"prefix": "filter2",
"body": [
"//【ture】表示筛选到,【false】表示过滤掉",
"filter: (rowData) => {",
"if (rowData.status == 1) { return true",
"}",
"return false",
"},",
"$1",
],
"description": "yx动作action过滤2"
},
"获取URL的参数": {
"prefix": "utilgetParameter",
"body": [
"import utils from \"utils$1\"",
"this.id = utils.getParameter(\"id\")",
"$2",
],
"description": "获取URL的参数"
},
"获取详情": {
"prefix": "getdatail",
"body": [
"async getDatail(id) {",
"let { resultMsg, resultCode, data } = await request.getDetail({",
"id: this.id || utils.getParameter(\"id\"),",
"})",
"if (data) {,",
"const { form: { setFieldsValue } } = this.props",
"setFieldsValue(data)",
"}",
"}",
],
"description": "获取详情"
},
//———————————————————— 请求api ————————————————————
"使用get请求api接口": {
"prefix": "apigetRequest",
"body": [
"//获取单条优惠券详情$1",
"static detail$2(params) {",
"return request({",
"url: `$3/${params.id}`,",
"method: 'get',",
" params,",
" // data: params,",
"headers: { 'Content-type': 'application/json' }",
" })",
"}",
],
"description": "使用get请求api接口"
},
"使用post请求api接口": {
"prefix": "apipostRequest",
"body": [
"//获取单条优惠券详情$1",
"static post$2(params={}) {",
"return request({",
"url: `$3`,",
"method: 'post',",
"//params,",
"data: params,",
"headers: { 'Content-type': 'application/json' }",
" })",
"}",
"$4"
],
"description": "使用post请求api接口"
},
"使用put请求api接口": {
"prefix": "apiputRequest",
"body": [
"//获取单条优惠券详情$1",
"static put$2(params={}) {",
"return request({",
"url: `$3`,",
"method: 'put',",
"params,",
"//data: params,",
"headers: { 'Content-type': 'application/json' }",
" })",
"}",
"$4"
],
"description": "使用put请求api接口"
},
"使用delete请求api接口": {
"prefix": "apideleteRequest",
"body": [
"//【删除】$1",
"static delete(params) {",
"return request({",
"url: `coupon/${params.id}`,",
"method: 'delete$3',",
" params,",
" // data: params,",
"headers: { 'Content-type': 'application/json' }",
" })",
"}",
],
"description": "使用delete请求api接口"
},
//———————————————————— 格式转化 ————————————————————
"moment范围格式转化": {
"prefix": "momentrange",
"body": [
"import moment from 'moment'",
"if (data.transferCreateTime){",
"let timeFomrmat = \"YYYY-MM-DD HH:mm:ss\"",
"data.createStartTime = moment(data.transferCreateTime[0]).format(timeFomrmat)",
"data.createEndTime = moment(data.transferCreateTime[1]).format(timeFomrmat)",
"delete data.transferCreateTime",
"}",
],
"description": "moment范围格式转化"
},
}