当我运行一个vue-cli项目时,我看到以下内容:
DONE Compiled successfully in 5778ms
App running at:
- Local: http://localhost:8080/
- Network: http://192.168.178.9:8080/
Note that the development build is not optimized.
To create a production build, run npm run build.
我不希望我的应用仅在本地主机上运行在本地网络上。 如何关闭本地网络部分?
答案 0 :(得分:6)
public class Snake {
String snakeID;
String snakeName;
String scientificName;
public Snake()
{
}
public Snake(String snakeID, String snakeName, String scientificName) {
this.snakeID = snakeID;
this.snakeName = snakeName;
this.scientificName = scientificName;
}
public String getSnakeID() {
return snakeID;
}
public String getSnakeName() {
return snakeName;
}
public String getScientificName() {
return scientificName;
}
}
将// vue.config.js
{
devServer: {
host: "localhost"
}
}
设置为host
将禁用webpack-dev-server中的网络访问。
"localhost"