问题说明
vue的项目本地能运行正常,但是build后把dist文件部署到生产环境(nginx)后,打开网站,一片空白,控制台提示:
isURLSameOrigin.js?3934:57 Uncaught (in promise) TypeError: Cannot read property 'protocol' of undefined at isURLSameOrigin (isURLSameOrigin.js?3934:57) at dispatchXhrRequest (xhr.js?b50d:103) at new Promise (<anonymous>) at xhrAdapter (xhr.js?b50d:11) at dispatchRequest (dispatchRequest.js?5270:59)
问题解决
问题可能出在axios的引用问题,检查main.js是否如下代码:
import axios from 'axios' Vue.use(axios)
改成如下:
import axios from 'axios' Vue.prototype.axios = axios
文章评论