Vue cross-domain request proxyTable problem

this is the addition of index.js to proxyTable in config

 proxyTable: {
       "/research": {
         target: "https://api.shenjian.io/?appid=c36a22e564a2954e&keyword=a&pageNo=1&pageSize=20",
 //
        changeOrigin: true,  //
         pathRewrite: {
           "^/research": "/c"   //
         }
       }
     }
           

add index.js interface in api

export default {
    songsearch: "/research"
  }

call the ajax function in

store

  mutations: {
    changeKeyword(state, x) {
      ajax(require.songsearch)
    }
   }

ajax

const ajax = function (url) {
  return new Promise(function (resolve, reject) {
    axios.get(url).then(res => {
      resolve(res);
    }).catch(reject);
  });
}

this is the result

I just started to learn that vue, wants to be a web player and has already got the api, but the axios request needs to be cross-domain, so it uses the proxyTable method to proxy, but the request address becomes the port number, why?

Apr.03,2021

after you configure it like this, the interface you access is https://api.shenjian.io/?appi..
and in the browser, although you see localhost:8080, it has actually been forwarded to the target you want to request through the agent

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