How to understand success and fail, in functions I remember that even anonymous functions need to be called in parentheses.

export const geocoder = (lat, lon, success = () => {}, fail = () => {}) => {
  return wx.request({
    url: "https://apis.map.qq.com/ws/geocoder/v1/",
    data: {
      location: `${lat},${lon}`,
      key: QQ_MAP_KEY,
      get_poi: 0
    },
    success,
    fail
  })
}
May.24,2021

this is the object literal abbreviation of ES6 . will automatically help you complete the assignment of key values
ES6

.
wx.request({
    success,
    fail
  })

equals ES5

wx.request({
    success: success,
    fail: fail
  })

your geocoder is a function, success and fail are just the parameters you pass, the default value of the parameter is a function, and the success and fail here are just function parameters


this is the abbreviation of the literal quantity of objects in ES6. It is recommended that you take a look at this

.
MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1b3ce04-2c356.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1b3ce04-2c356.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?