非常简单,只要加一个配置!第1步,复制这个代码(端口可改)"config":{"nuxt":{"host":"0.0.0.0",
非常简单,只要加一个配置!
第1步,复制这个代码(端口可改)
"config": {
"nuxt": {
"host": "0.0.0.0",
"port": "8090"
}
},
第2步,找到根目录下的package.json,把代码粘贴进去。
这是全部的代码,我这里配置在了8~13行。
{
"name": "guanWangPhone",
"version": "1.0.0",
"description": "My bee's knees Nuxt.js project",
"author": "kason",
"private": true,
"config": {
"nuxt": {
"host": "0.0.0.0",
"port": "8090"
}
},
"scripts": {
"dev": "cross-env NODE_ENV=development nodemon server/index.js --watch server",
"build": "nuxt build",
"start": "cross-env NODE_ENV=production node server/index.js",
"generate": "nuxt generate"
},
"dependencies": {
"cross-env": "^5.2.0",
"element-ui": "^2.4.11",
"koa": "^2.6.2",
"nuxt": "^2.0.0",
"postcss-px2rem": "^0.3.0"
},
"devDependencies": {
"node-sass": "^4.13.0",
"nodemon": "^1.18.9",
"sass-loader": "^8.0.0",
"scss-loader": "0.0.1"
}
}
以上就是本文的全部内容,希望对大家的学习有所帮助,也希望大家多多支持脚本之家。
nuxt 指定IP nuxt 端口访问