uniapp 踩坑笔记

150 阅读1分钟

h5 router 使用 history

"h5" : {
	"publicPath": "./",
	"router" : {
		"mode" : "history",
		"base" : "/h5/"
	},
	"domain" : ""
}

 发布线上环境时,需要服务器配置 nginx 否则访问页面出现 404

/**
* /h5 为 子目录
*/
 
location /h5 {
    try_files $uri $uri/ /h5/index.html last;
    index  index.html;
}