Vue-resource cross-domain problem

I practiced what vue did during the project, so I used the third-party interface. Using proxies in local testing can solve cross-domain problems, as follows

proxyTable: {
    "/api": {  //"/api""https://zapi.tourzj.com" 
    target: "https://zapi.tourzj.com", // 
    changeOrigin: true, // 
    pathRewrite: { 
      "^/api": "https://zapi.tourzj.com" // 
      }
    }
},

but there is a cross-domain problem when uploading to its own server. Baidu says that it defines a global js,. How do you define it? Do you want to refer to it on each page after it is defined?

Nov.29,2021

Local development is done with the agent in webpack-dev-server , but when you produce a package, you must use nginx to forward it, or write a node (server language is fine) as the middle layer ~


use axios. Officially recommended, and cross-domain problems are usually solved by setting up a proxy or setting cors in the background to achieve cross-domain


. The method is as follows:
defines a variable to be mounted on Vue, written as follows: Vue.prototype.API_PROXY =' https://bird.ioliu.cn/v1/?url=';
then write the url address in the requested page as: var url = this.API_PROXY +' http://www.xxx.com';
last axios.get (url). Then (res= > {})

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