🔧 build(H5): 解决build H5 端失败的问题
This commit is contained in:
parent
fb589f120f
commit
2bd4d07fbb
11
package.json
11
package.json
@ -39,10 +39,14 @@
|
|||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@babel/runtime": "^7.7.7",
|
"@babel/runtime": "^7.7.7",
|
||||||
"@tarojs/components": "3.5.5",
|
"@tarojs/components": "3.5.5",
|
||||||
"@tarojs/plugin-framework-react": "^3.4.12",
|
"@tarojs/helper": "^3.5.5",
|
||||||
|
"@tarojs/plugin-framework-react": "^3.5.5",
|
||||||
"@tarojs/react": "3.5.5",
|
"@tarojs/react": "3.5.5",
|
||||||
|
"@tarojs/router": "^3.5.5",
|
||||||
"@tarojs/runtime": "^3.5.5",
|
"@tarojs/runtime": "^3.5.5",
|
||||||
|
"@tarojs/shared": "^3.5.5",
|
||||||
"@tarojs/taro": "3.5.5",
|
"@tarojs/taro": "3.5.5",
|
||||||
|
"@tarojs/taro-h5": "^3.5.5",
|
||||||
"big.js": "^6.2.1",
|
"big.js": "^6.2.1",
|
||||||
"dayjs": "^1.11.3",
|
"dayjs": "^1.11.3",
|
||||||
"qs": "^6.10.3",
|
"qs": "^6.10.3",
|
||||||
@ -51,13 +55,12 @@
|
|||||||
"react-redux": "^8.0.1",
|
"react-redux": "^8.0.1",
|
||||||
"redux": "^4.2.0",
|
"redux": "^4.2.0",
|
||||||
"redux-logger": "^3.0.6",
|
"redux-logger": "^3.0.6",
|
||||||
"redux-thunk": "^2.4.1",
|
"redux-thunk": "^2.4.1"
|
||||||
"tarojs": "^2.1.1"
|
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@babel/core": "^7.8.0",
|
"@babel/core": "^7.8.0",
|
||||||
"@pmmmwh/react-refresh-webpack-plugin": "0.5.4",
|
"@pmmmwh/react-refresh-webpack-plugin": "0.5.4",
|
||||||
"@tarojs/plugin-mini-ci": "^3.5.1",
|
"@tarojs/cli": "^3.5.5",
|
||||||
"@tarojs/plugin-platform-weapp": "^3.5.5",
|
"@tarojs/plugin-platform-weapp": "^3.5.5",
|
||||||
"@tarojs/plugin-react-devtools": "^3.4.13",
|
"@tarojs/plugin-react-devtools": "^3.4.13",
|
||||||
"@tarojs/webpack5-runner": "^3.5.5",
|
"@tarojs/webpack5-runner": "^3.5.5",
|
||||||
|
59
src/app.tsx
59
src/app.tsx
@ -11,39 +11,40 @@ type ParamsType = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const store = configStore()
|
const store = configStore()
|
||||||
const App: FC<ParamsType> = (params) => {
|
const App: FC<ParamsType> = params => {
|
||||||
const { children } = params
|
const { children } = params
|
||||||
|
if (process.env.TARO_ENV === 'weapp') {
|
||||||
Taro.showShareMenu({
|
Taro.showShareMenu({
|
||||||
withShareTicket: true,
|
withShareTicket: true,
|
||||||
})
|
|
||||||
|
|
||||||
//分享
|
|
||||||
shareShop()
|
|
||||||
|
|
||||||
//检查版本更新
|
|
||||||
onAppShow(() => {
|
|
||||||
const updateManager = Taro.getUpdateManager()
|
|
||||||
updateManager.onCheckForUpdate(function (res) {
|
|
||||||
// 请求完新版本信息的回调
|
|
||||||
console.log('版本信息:', res.hasUpdate)
|
|
||||||
})
|
})
|
||||||
updateManager.onUpdateReady(function () {
|
|
||||||
Taro.showModal({
|
//分享
|
||||||
title: '更新提示',
|
shareShop()
|
||||||
content: '新版本已经准备好,是否重启应用?',
|
|
||||||
success: function (res) {
|
//检查版本更新
|
||||||
if (res.confirm) {
|
onAppShow(() => {
|
||||||
// 新的版本已经下载好,调用 applyUpdate 应用新版本并重启
|
const updateManager = Taro.getUpdateManager()
|
||||||
updateManager.applyUpdate()
|
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 (
|
return (
|
||||||
<ContextBlueTooth>
|
<ContextBlueTooth>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user