NO 'Access-Control-Allow-Origin' header is present on the requested resource.Origin'http://localhost:11000' is therfore not allowed access'
1、原因:瀏覽器的同源策略不允許跨域訪問,所謂同源策略是指協議、域名(服務器)、端口相同。
2、解決:采用ProxyTable解決。
1)什么是ProxyTable
vue-cli提供的解決vue開發環境下跨域問題的方法。ProxyTable的底層使用了http-proxy-middleware(http://github.com/chimurai/http-proxy-middleware),他是http的代理中間件,它依賴於node.js,基本原理使用服務器端代理解決瀏覽器跨域問題。
服務端與服務端的訪問不存在跨域問題。