uniapp歷史模式history配置


//我們使用hash模式時,打包線上,容易出現頁面空白的情況,所以如下配置

 "h5" : {
        "devServer" : {
	"publicPath":"./"
            "https" : false,
            "port" : 3000,
            "disableHostCheck" : true,
            "proxy" : {
                "/api" : {
                    "target" : "https://m.shop.com",
                    "ws" : true,
                    "changOrigin" : true,
                    "pathRewrite" : {
                        "^/api" : ""
                    }
                }
            }
        },
}

  //但我們使用歷史模式(history)模式的時候,不能用hash模式的配置

    "h5" : {
        "devServer" : {
			// "publicPath":"./"   //注意隱藏這行
            "https" : false,
            "port" : 3000,
            "disableHostCheck" : true,
            "proxy" : {
                "/api" : {
                    "target" : "m.shop.com",
                    // "target":"http://localhost:8080/hht_mall/",
                    "ws" : true,
                    "changOrigin" : true,
                    "pathRewrite" : {
                        "^/api" : ""
                    }
                }
            }
        },
        "router" : {
            "base" : "mall/website/",    //填寫你的線上地址(如http://m.shop.com/mall/webiste/,線上根目錄是http://m.shop.com,取得是根目錄后的mall/website, 注意本地開發時需要隱藏這行
            "mode" : "history"
        },
}

  


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM