公司做网站用什么主机,争对银行排队做一网站,空间一个数据库可以做几个网站,服装网站建设规定Web组件支持前端页面选择文件上传功能#xff0c;应用开发者可以使用onShowFileSelector()接口来处理前端页面文件上传的请求。
下面的示例中#xff0c;当用户在前端页面点击文件上传按钮#xff0c;应用侧在onShowFileSelector()接口中收到文件上传请求#xff0c;在此接…Web组件支持前端页面选择文件上传功能应用开发者可以使用onShowFileSelector()接口来处理前端页面文件上传的请求。
下面的示例中当用户在前端页面点击文件上传按钮应用侧在onShowFileSelector()接口中收到文件上传请求在此接口中开发者将上传的本地文件路径设置给前端页面。
应用侧代码。
// xxx.ets
import web_webview from ohos.web.webview;
import picker from ohos.file.picker;
import { BusinessError } from ohos.base;Entry
Component
struct WebComponent {controller: web_webview.WebviewController new web_webview.WebviewController()build() {Column() {Web({ src: $rawfile(local.html), controller: this.controller }).onShowFileSelector((event) {console.log(MyFileUploader onShowFileSelector invoked)const documentSelectOptions new picker.DocumentSelectOptions();let uri: string | null 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);if (event) {event.result.handleFileList([uri]);}}).catch((err: BusinessError) {console.error(Invoke documentViewPicker.select failed, code is ${err.code}, message is ${err.message});})return true})}}
}local.html页面代码。
!DOCTYPE html
html
headmeta charsetutf-8titleDocument/title
/headbody
!-- 点击上传文件按钮 --
input typefile valuefile/br
meta nameviewport contentwidthdevice-width /
/body
/html如果大家还没有掌握鸿蒙现在想要在最短的时间里吃透它我这边特意整理了《鸿蒙语法ArkTS、TypeScript、ArkUI等…视频教程》以及《鸿蒙开发学习手册》共计890页希望对大家有所帮助https://docs.qq.com/doc/DZVVBYlhuRkZQZlB3
鸿蒙语法ArkTS、TypeScript、ArkUI等…视频教程https://docs.qq.com/doc/DZVVBYlhuRkZQZlB3 OpenHarmony APP开发教程步骤https://docs.qq.com/doc/DZVVBYlhuRkZQZlB3 《鸿蒙开发学习手册》
如何快速入门https://docs.qq.com/doc/DZVVBYlhuRkZQZlB3
1.基本概念 2.构建第一个ArkTS应用 3.……
开发基础知识https://docs.qq.com/doc/DZVVBYlhuRkZQZlB3
1.应用基础知识 2.配置文件 3.应用数据管理 4.应用安全管理 5.应用隐私保护 6.三方应用调用管控机制 7.资源分类与访问 8.学习ArkTS语言 9.……
基于ArkTS 开发https://docs.qq.com/doc/DZVVBYlhuRkZQZlB3
1.Ability开发 2.UI开发 3.公共事件与通知 4.窗口管理 5.媒体 6.安全 7.网络与链接 8.电话服务 9.数据管理 10.后台任务(Background Task)管理 11.设备管理 12.设备使用信息统计 13.DFX 14.国际化开发 15.折叠屏系列 16.……
鸿蒙生态应用开发白皮书V2.0PDFhttps://docs.qq.com/doc/DZVVkRGRUd3pHSnFG