Vue-cli scaffolding builds pages, and axios asks how to request api, with parameters.

scaffolding built with vue-cli,

now there is api, but he has a parameter
{"CatId": 238, "Similar": false, "Trend": false, "IsNew": false, "Sales": true, "SuppNo": "LKN", "SuppCatId": 0}
http://116.62.33.192:66/product/getproductdetaillist

write as axion on the Internet. I don"t know where to write the parameters.

"/api": {
                target:"http://116.62.33.192:66/product/getproductdetaillist",
                changeOrigin:true, 
                pathRewrite:{
                    "^/api": "/api"
                }
            }
            
            
let postData = {"CatId": 238, "Similar": false, "Trend": false, "IsNew": false, "Sales": true, "SuppNo": "LKN", "SuppCatId": 0}
export default {
  methods: {
    jsonpData: function () {
      this.$axios.post("/api", postData)
        .then(res => {
          console.log(res)
        })
        .catch(err => {
          console.log(err)
        })
    }
  }
}

write this way, he says 404, if you don"t, he says 405.

Mar.18,2021

if it is a get request, axios.get ('interface address', {params: {passed parameter}})

if it is a post request .axios.post ('interface address', the parameter object representation passed)


try Post and Get, or other methods for request

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