【问题标题】:How can I bind `vue ui` to another IP? (vue-cli 3)如何将 `vue ui` 绑定到另一个 IP? (vue-cli 3)
【发布时间】:2018-12-17 10:26:47
【问题描述】:

我在 docker 中使用 vue-cli,必须将服务绑定到 LAN IP 或 0.0.0.0 才能“本地”访问它们。

我期待--host 0.0.0.0,但那不存在。

$ vue ui ???? Starting GUI... ???? Ready on http://localhost:8000

$ vue ui -h Usage: ui [options] start and open the vue-cli ui Options: -p, --port <port> Port used for the UI server (by default search for awailable port) -D, --dev Run in dev mode --quiet Don't output starting messages --headless Don't open browser on start and output port -h, --help output usage information

【问题讨论】:

    标签: vue-cli


    【解决方案1】:

    我在 Vagrant 实例中使用 Vue.js 进行开发,最初遇到了同样的问题。

    看起来 -H / --host 选项是在 vue-cli 版本 3.1.0 中添加的: https://github.com/vuejs/vue-cli/pull/2568

    $ vue --version
    3.1.3
    
    $ vue ui -h
    Usage: ui [options]
    
    start and open the vue-cli ui
    
    Options:
      -H, --host <host>  Host used for the UI server (default: localhost)
      -p, --port <port>  Port used for the UI server (by default search for available port)
      -D, --dev          Run in dev mode
      --quiet            Don't output starting messages
      --headless         Don't open browser on start and output port
      -h, --help         output usage information
    
    $ vue ui -H 0.0.0.0
    ?  Starting GUI...
    ?  Ready on http://0.0.0.0:8000
    

    这解决了我的问题。

    【讨论】:

      猜你喜欢
      • 2020-03-23
      • 2021-02-20
      • 1970-01-01
      • 2019-02-10
      • 2019-06-12
      • 2019-04-20
      • 2021-10-26
      • 2019-02-05
      • 2019-06-10
      相关资源
      最近更新 更多