search

Home  >  Q&A  >  body text

javascript - vue uses native jsonp, how to make the jsonp returned in the background call the callback function?

It’s like this, I use the native jsonp in vue, and then the jsonp returned in the background cannot always be called when calling callback! The following is part of my source code.

https://codepen.io/1206189299...
Error report:
Please ignore the packaging error

学习ing学习ing2786 days ago915

reply all(3)I'll reply

  • 过去多啦不再A梦

    过去多啦不再A梦2017-07-05 10:44:18

    window.getData=function (data){
    xxx logic
    }

    reply
    0
  • 给我你的怀抱

    给我你的怀抱2017-07-05 10:44:18

    Obviously Vue has its own namespace, if you don’t use it explicitly

    window.yourCallbackFunction=function(data){
    //处理 data
    }

    Defining the global function in this way, jsonp obviously cannot successfully call the callback function.

    reply
    0
  • 三叔

    三叔2017-07-05 10:44:18

    To handle cross-domain requests, you can use webpack to configure the proxy to forward the request or use the node proxy service to forward the request

    reply
    0
  • Cancelreply