Configuration when the vue project starts the front end and allows other devices on the local LAN to access this project

Article directory

Edit package.json

    "dev": "vite --host [本机ip]" ,

Case

Insert image description here

optimization

In this case, the practicality is better. If we visit, we can still access the server IP normally.

    "dev": "vite --host 0.0.0.0" ,

Insert image description here

Guess you like

Origin blog.csdn.net/qq_39123467/article/details/131676788