1. The vue project uses ajax synchronization request in order for the operation and maintenance personnel to modify the background service address after packaging, but chrome gave a warning⚠️
The root directory of my project can be requested and then spliced with the corresponding address.
let baseUrl
import { Ajax } from './components/commonjs/ajax.js'
Ajax.get('./static/baseApi.json', function (res) {
let jsonRes = JSON.parse(res)
console.log('Requested content:', jsonRes.baseUrl)
baseUrl = jsonRes.baseUrl
tempstaticUrl = jsonRes.staticUrl
tempmodelLoadedUrl = jsonRes.modelLoadedUrl
})
// let baseUrl = '/CpyService'
console.log('The background address currently being accessed is: ', baseUrl)
export default {
authCode: baseUrl '/ AuthImageCode/authCode'
}
But the chrome console gave a warning:
ajax.js?4a26:6 [Deprecation] Synchronous XMLHttpRequest on the main thread is deprecated because of its detrimental effects to the end user's experience . For more help, check https://xhr.spec.whatwg.org/.
This warning means that you are using ajax with async=false. It has nothing to do with your packaging or anything else
Consider using jsonp? Data introduced using script tags,