a)解决vue无法使用本机ip启动服务
1.在json内的“scripts”下的“dev”的尾部添加“ --host 0.0.0.0”
2.将vue config内的index.js文件打开设置“host”属性值为“0.0.0.0”
3.npm run dev 就可以将应用起在本机的ip之内.


b)解决跨域
解决vue跨域问题其实很简单,只需要在vue的index.js文件设置服务器代理就可以了

a)解决vue无法使用本机ip启动服务
1.在json内的“scripts”下的“dev”的尾部添加“ --host 0.0.0.0”
2.将vue config内的index.js文件打开设置“host”属性值为“0.0.0.0”
3.npm run dev 就可以将应用起在本机的ip之内.
b)解决跨域
解决vue跨域问题其实很简单,只需要在vue的index.js文件设置服务器代理就可以了
本文标题:vue cli采坑之路
本文链接:https://www.haomeiwen.com/subject/txaqgftx.html
网友评论