微信小程序 封装api 接口文件文件 与 调用

  作者:chrispy

function accountsIdentity(params, method) { return new Promise((resolve) => { wx.request({ url: `https://baidu.com/xxx/xxx`, data: params, method: method, success: (data) => { resolve(data.data) } }) })}module.exports =

function accountsIdentity(params, method) {

  return new Promise((resolve) => {

    wx.request({

      url: `https://baidu.com/xxx/xxx`,

      data: params,

      method: method,

      success: (data) => {

        resolve(data.data)

      }

    })

  })

}

module.exports = {

  accountsIdentity

}

const axios = require('../../utils/axios.js') // 引用外部的js文件

const params = { type: 4, tenantId: 1164523599620829185 }

axios.accountsIdentity(params, 'get').then(res => {

    console.log(res)

})


有用  |  无用

猜你喜欢