Skip to content

Commit 5e043cc

Browse files
committed
wip(web): 传递 异步组件加载失败 error 信息
1 parent 087b326 commit 5e043cc

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

packages/uni-h5-vite/src/plugins/pagesJson.ts

+2-1
Original file line numberDiff line numberDiff line change
@@ -236,8 +236,9 @@ function generatePagesDefineCode(
236236
if(async.error){
237237
AsyncComponentOptions.errorComponent = {
238238
name:'SystemAsyncError',
239+
props:['error'],
239240
render(){
240-
return createVNode(resolveComponent(async.error))
241+
return createVNode(resolveComponent(async.error), { error: this.error })
241242
}
242243
}
243244
}

packages/uni-h5/src/framework/components/async-error/index.tsx

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
11
import { defineSystemComponent } from '@dcloudio/uni-components'
2-
import { useI18n, initI18nAsyncMsgsOnce } from '@dcloudio/uni-core'
2+
import { initI18nAsyncMsgsOnce, useI18n } from '@dcloudio/uni-core'
33

44
function reload() {
55
window.location.reload()
66
}
77

88
export default /*#__PURE__*/ defineSystemComponent({
99
name: 'AsyncError',
10+
props: ['error'],
1011
setup() {
1112
initI18nAsyncMsgsOnce()
1213
const { t } = useI18n()

0 commit comments

Comments
 (0)