1.获取本即IP
2.将本机IP替换localhost
方法一:
config文件夹里 index.js
host: 'localhost',// can be overwritten by process.env.HOST
更改为
host: '你的ip',// can be overwritten by process.env.HOST
方法二:
package.json
scripts里dev的值 最后加上–host
"scripts": {
"dev": "node build/dev-server.js",
...
},
"scripts": {
"dev": "node build/dev-server.js --host 你的ip",
...
},