diff --git a/zh-cn/application-dev/reference/arkui-ts/ts-basic-components-web.md b/zh-cn/application-dev/reference/arkui-ts/ts-basic-components-web.md index e4194eaa42dafbb521d51773797d9ef6aa2f5ae4..3540849b64042b6b1082782ce3a7c314244358b5 100755 --- a/zh-cn/application-dev/reference/arkui-ts/ts-basic-components-web.md +++ b/zh-cn/application-dev/reference/arkui-ts/ts-basic-components-web.md @@ -2193,7 +2193,8 @@ onShowFileSelector(callback: (event?: { result: FileSelectorResult, fileSelector ```ts // xxx.ets - import web_webview from '@ohos.web.webview' + import web_webview from '@ohos.web.webview'; + import picker from '@ohos.file.picker'; @Entry @Component @@ -2202,24 +2203,18 @@ onShowFileSelector(callback: (event?: { result: FileSelectorResult, fileSelector build() { Column() { - Web({ src: 'www.example.com', controller: this.controller }) + Web({ src: $rawfile('index.html'), controller: this.controller }) .onShowFileSelector((event) => { - AlertDialog.show({ - title: event.fileSelector.getTitle(), - message: 'isCapture:' + event.fileSelector.isCapture() + " mode:" + event.fileSelector.getMode() + 'acceptType:' + event.fileSelector.getAcceptType(), - confirm: { - value: 'upload', - action: () => { - let fileList: Array = [ - '/data/storage/el2/base/test', - ] - event.result.handleFileList(fileList) - } - }, - cancel: () => { - let fileList: Array = [] - event.result.handleFileList(fileList) - } + console.log('MyFileUploader onShowFileSelector invoked') + const documentSelectOptions = new picker.DocumentSelectOptions(); + let uri = null; + const documentViewPicker = new picker.DocumentViewPicker(); + documentViewPicker.select(documentSelectOptions).then((documentSelectResult) => { + uri = documentSelectResult[0]; + console.info('documentViewPicker.select to file succeed and uri is:' + uri); + event.result.handleFileList([uri]); + }).catch((err) => { + console.error(`Invoke documentViewPicker.select failed, code is ${err.code}, message is ${err.message}`); }) return true }) @@ -2227,6 +2222,19 @@ onShowFileSelector(callback: (event?: { result: FileSelectorResult, fileSelector } } ``` + + 加载的html文件。 + ```html + + + + + + +
+ + + ``` ### onResourceLoad9+