1.创建文件
npx create-nuxt-app 项目名称(项目不能有大写字母)
其中要选择 uniserval(ssr)
2.选择运行的ip地址
package.json中配置
"config":{
"nuxt":{
"port":"8080,
"host":"电脑的ip"
}
}
配置后只能在自己机器上运行,打包后会报错,可以在打包之前删除
- 配置运行地址随着运行的ip而变化
npm install internal-ip
nuxt.config.js中修改
const {internalIpV4Sync} = require('internal-ip');
server:{
host:internalIpV4Sync(), port: 3000
}
配置后,就会在运行项目的机器的ip地址,端口是3000运行
1).assets/css文件夹中创建reset.css,用于样式重置
html,body,div,span,applet,object,h1,h2,h3,h4,h5,h6,p,blockquote,pre,a,abbr,acronym,address,big,cite,code,del,dfn,em,img,ins,kbd,q,s,samp,small,strike,strong,sub,sup,tt,var,b,u,i,center,dl,dt,dd,ol,ul,li,fieldset,form,label,legend,table,caption,tbody,tfoot,thead,tr,th,td,article,aside,canvas,details,embed,figure,figcaption,footer,header,hgroup,menu,nav,output,ruby,section,summary,time,mark,audio,video {
margin:0;
padding:0;
border:0;
font-size:100%;
font:inherit;
font-weight:normal;
vertical-align:baseline;
}
/* HTML5 display-role reset for older browsers */
article,aside,details,figcaption,figure,footer,header,hgroup,menu,nav,section {
display:block;
}
ol,ul,li {
list-style:none;
}
blockquote,q {
quotes:none;
}
blockquote:before,blockquote:after,q:before,q:after {
content:'';
content:none;
}
table {
border-collapse:collapse;
border-spacing:0;
}
th,td {
vertical-align:middle;
}
/* custom */
a {
outline:none;
color:#16418a;
text-decoration:none;
-webkit-backface-visibility:hidden;
}
a:focus {
outline:none;
}
input:focus,select:focus,textarea:focus {
outline:-webkit-focus-ring-color auto 0;
}
2)nuxt.config.js中配置css
css:['@/assets/css/reset.css']
"node-sass": "^4.14.1",
"sass-loader": "^8.0.2",
"scss-loader": "0.0.1"