uni-app打包H5出現“網絡不給力,點擊屏幕重試”

  這是uni-app默認在弱網或者斷網的情況下反饋出來的。可以在manifest.json中延長時間來解決問題。

部分代碼:

 "h5": {
        "title": "演示", //頁面標題,默認使用 manifest.json 的 name
        "template": "index.html", //index.html模板路徑,相對於應用根目錄,可定製生成的 html 代碼
        "router": {
            "mode": "history", //路由跳轉模式,支持 hash|history ,默認 hash
            "base": "/hello/" //應用基礎路徑,例如,如果整個單頁應用服務在 /app/ 下,然後 base 就應該設爲 "/app/"
        },
        "async": { //頁面js異步加載配置
            "loading": "AsyncLoading", //頁面js加載時使用的組件(需註冊爲全局組件)
            "error": "AsyncError", //頁面js加載失敗時使用的組件(需註冊爲全局組件)
            "delay": 200, //展示 loading 加載組件的延時時間(頁面 js 若在 delay 時間內加載完成,則不會顯示 loading 組件)
            "timeout": 3000 //頁面js加載超時時間(超時後展示 error 對應的組件)
        }
    },
	"networkTimeout": {
		"request": 6000     //uni.request的settimeout
	}

參考網站:

https://uniapp.dcloud.io/collocation/manifest

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章