🔧 build(H5): 解决build H5 端失败的问题

This commit is contained in:
2022-09-19 22:49:48 +08:00
parent fb589f120f
commit 2bd4d07fbb
3 changed files with 2370 additions and 1914 deletions
+30 -29
View File
@@ -11,39 +11,40 @@ type ParamsType = {
}
const store = configStore()
const App: FC<ParamsType> = (params) => {
const App: FC<ParamsType> = params => {
const { children } = params
Taro.showShareMenu({
withShareTicket: true,
})
//分享
shareShop()
//检查版本更新
onAppShow(() => {
const updateManager = Taro.getUpdateManager()
updateManager.onCheckForUpdate(function (res) {
// 请求完新版本信息的回调
console.log('版本信息:', res.hasUpdate)
if (process.env.TARO_ENV === 'weapp') {
Taro.showShareMenu({
withShareTicket: true,
})
updateManager.onUpdateReady(function () {
Taro.showModal({
title: '更新提示',
content: '新版本已经准备好,是否重启应用?',
success: function (res) {
if (res.confirm) {
// 新的版本已经下载好,调用 applyUpdate 应用新版本并重启
updateManager.applyUpdate()
}
},
//分享
shareShop()
//检查版本更新
onAppShow(() => {
const updateManager = Taro.getUpdateManager()
updateManager.onCheckForUpdate(function(res) {
// 请求完新版本信息的回调
console.log('版本信息:', res.hasUpdate)
})
updateManager.onUpdateReady(function() {
Taro.showModal({
title: '更新提示',
content: '新版本已经准备好,是否重启应用?',
success: function(res) {
if (res.confirm) {
// 新的版本已经下载好,调用 applyUpdate 应用新版本并重启
updateManager.applyUpdate()
}
},
})
})
updateManager.onUpdateFailed(function() {
console.log('新版本更新失败')
})
})
updateManager.onUpdateFailed(function () {
console.log('新版本更新失败')
})
})
}
return (
<ContextBlueTooth>