Vue project settings LAN can be accessed

        By default, Vue projects are started with npm run serve, which can only be accessed locally. If you want to make it accessible in the local area network, you need to add the --host 0.0.0.0 option after the startup command, so that you can listen to all network interfaces.

method one:

Open the package.json file, find the serve command in scripts, and modify it to the following code:

"serve": "vue-cli-service serve --host 0.0.0.0"

Method Two:

Open the root directory of the Vue.js project in the Linux terminal and enter the following command:

npm run serve -- --host 0.0.0.0

Reference blog post: Vue project settings can be accessed through the LAN-Python Technology Station

Guess you like

Origin blog.csdn.net/weixin_44799217/article/details/131355783