javascript - The vue project uses an ajax synchronization request so that the operation and maintenance personnel can modify the background service address after packaging, but chrome gave a warning⚠️
淡淡烟草味
淡淡烟草味 2017-05-17 09:57:30
0
2
1161

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⚠️

  1. 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'
    }

    1. 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/.

淡淡烟草味
淡淡烟草味

reply all(2)
为情所困

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,

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template