打开vite.config.js
import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
// https://vitejs.dev/config/
export default defineConfig({
plugins: [vue()],
server:{
host:'0.0.0.0'
}
})
结果:

关于0.0.0.0的问题可以参考:localhost 和 0.0.0.0 区别_zwkkkk1的博客-CSDN博客