Home >Web Front-end >JS Tutorial >vue init webpack myproject builds the solution to the problem that the IP cannot be accessed

vue init webpack myproject builds the solution to the problem that the IP cannot be accessed

亚连
亚连Original
2018-05-25 17:19:141226browse

下面我就为大家分享一篇vue init webpack myproject构建项目 ip不能访问的解决方法,具有很好的参考价值,希望对大家有所帮助。

问题

vue init webpack myproject构建项目 使用localhost 或者127.0.0.1 均可以正常访问,但是切换到本地ip就不行了

解决方式

在 webpack.dev.conf.js 追加以下代码

const HOST = process.env.HOST || '0.0.0.0';

重新启动

npm run dev

重新打开即可

上面是我整理给大家的,希望今后会对大家有帮助。

相关文章:

AJAX请求队列实现

解决AJAX请求中含有数组的办法

使用ajax异步提交表单的几种方法总结

The above is the detailed content of vue init webpack myproject builds the solution to the problem that the IP cannot be accessed. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn