Skip to content
| Marketplace
Sign in
Visual Studio Code>Other>idss-api-func-initNew to Visual Studio Code? Get it now.
idss-api-func-init

idss-api-func-init

IDSS-FE

|
128 installs
| (0) | Free
接口请求函数生成器
Installation
Launch VS Code Quick Open (Ctrl+P), paste the following command, and press enter.
Copied to clipboard
More Info

idss-api-func-init

API代码段生成器

使用说明

1.在vscode插件库内搜索并安装插件‘idss-api-func-init’

2.进入相应文件内,编写API配置,例:

CHECK_CAN_CREATE: { 

 url: '/api/data-reporting/my-order/check-can-create',

 method: 'POST'

}

3.选项说明

const API = {
  TABLE: { 
    url: BASE_URL + 'event/query',
    tag: 'table-loading',
    method: 'post'
  }
 }
支持两种选择方式,区别在于生成代码的方法名不同

1、只选择常量名

TABLE_API
生成方法名规则:按下划线"_"切分"TABLE_API"并转驼峰--tableApi

2、选择‘TABLE’和‘url: BASE_URL + 'event/query',’

TABLE: { // 绕行概览表格请求
    url: BASE_URL + 'event/query-deal',
生成方法名规则:
  url: BASE_URL + 'event/query-deal'
  1.url值最后一个“/”后的值中包含“-”,直接取url值最后一个“/”后的值根据“-”并转驼峰 -- query_Deal
  url: BASE_URL + 'event/queryDeal'
  2.取后两位'event/queryDeal' -- eventQueryDeal

只选择常量名

选项名称 选项说明
默认 async table (params) {
await this.$request({
...API.TABLE,
data: params
})
}
默认-try&catch包裹 async table (params) {
try {
await this.$request({
...API.TABLE,
data: params
})
} catch (e) {
this.showMessage(e, 'error')
}
}
表格请求 async table (params) {
let res = await this.requestTable({
...API.TABLE,
currentObj: this.tableDataList,
params: params
})
this.tableDataList = res
}
表格请求-try&catch包裹 async table (params) {
try {
let res = await this.requestTable({
...API.TABLE,
currentObj: this.tableDataList,
params: params
})
this.tableDataList = res
} catch (e) {
this.showMessage(e, 'error')
}
}
方法返回promise async table (params) {
let res = await this.$request({
...API.TABLE,
data: params
})
return Promise.resolve(res)
}
方法返回promise-try&catch包裹 async table (params) {
try {
let res = await this.$request({
...API.TABLE,
data: params
})
return Promise.resolve(res)
} catch (e) {
this.showMessage(e, 'error')
}
}
  • Contact us
  • Jobs
  • Privacy
  • Manage cookies
  • Terms of use
  • Trademarks
© 2025 Microsoft