使用vue-cli时如何禁用在本地网络上运行应用程序?

时间:2018-10-16 06:44:23

标签: vue.js vue-cli-3

当我运行一个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.

我不希望我的应用仅在本地主机上运行在本地网络上。 如何关闭本地网络部分?

1 个答案:

答案 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"