After the cordova is packaged into apk, how to set up the axios asynchronous request?

the asynchronous request code in a general vue project is as follows:

invoke asynchronous request:

axios.get("/api/index.json").then()
The configuration code in

config/index.js is as follows:

proxyTable: {
  "/api": {
    target: "http://23.8.32.xxx",
    pathRewrite: {
      "^/api": "/static/mock"
    }
  }
},

npm run dev the data is accessible in the browser.

but packaged as apk , we can access the page through cordova serve android , and then access the page through http://localhost:8000/android/www/index.html-sharp/ in the browser (just like seeing the page on a mobile phone). The corresponding asynchronous request becomes http://localhost:8000/android/www/api/index.json, and this request returns 404 . So how do we modify the code that calls the asynchronous request above and the code related to the configuration of the asynchronous request ?


proxyTable takes effect only in development mode. Through cordova serve android , you are accessing the index.html file used in the packaged production environment, so the proxy is not valid.
request that url can directly write the absolute address on the server and the correct address will be accessed.
if the development environment and production environment want to request different addresses, you can make your own judgment.

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-1b36858-2c005.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-1b36858-2c005.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?