当前位置: 首页 > news >正文

洛宁网站开发seo优化网站排名

洛宁网站开发,seo优化网站排名,西安做网站多钱,品牌设计和平面设计的区别文章目录一、背景二、app发起分享1. 通过分享面板进行分享2. 使用其他应用打开二、处理分享的内容1. module.json5 配置可接收分享2. 解析分享的数据一、背景 在App开发中#xff0c;分享是常用功能#xff0c;这里介绍鸿蒙开发中#xff0c;其他应用分享到自己的app中module.json5 配置可接收分享2. 解析分享的数据一、背景 在App开发中分享是常用功能这里介绍鸿蒙开发中其他应用分享到自己的app中或者自己的app分享给其他app 鸿蒙系统分享地址 二、app发起分享 1. 通过分享面板进行分享 导入相关模块。 import { common } from kit.AbilityKit; import { systemShare } from kit.ShareKit; import { uniformTypeDescriptor as utd } from kit.ArkData;获取统一数据类型 可以自己确定分享的类型也可以调用方法通过后缀获取分享类型 getUniformDataTypeByFilenameExtension let utdTypeId if (file.extension.length 0) {utdTypeId utd.UniformDataType.FOLDER} else {utdTypeId utd.getUniformDataTypeByFilenameExtension(file.extension, utd.UniformDataType.OBJECT);}if (utdTypeId.length 0) {promptAction.showToast({message: appUtils.getResString(share_tip2)})return}构造分享数据可添加多条分享记录。 let shareData: systemShare.SharedData new systemShare.SharedData({utd: utdTypeId,uri: file.uri});启动分享面板时配置分享面板显示的位置信息或关联的组件ID面板将以Popup形式展示。 let controller: systemShare.ShareController new systemShare.ShareController(shareData);// 获取UIAbility上下文对象let context: common.UIAbilityContext getContext(this) as common.UIAbilityContext;// 进行分享面板显示controller.show(context, {previewMode: systemShare.SharePreviewMode.DEFAULT,selectionMode: systemShare.SelectionMode.SINGLE});2. 使用其他应用打开 通过context调用startAbility弹出系统弹窗使用其他应用打开文件 // Construct request data Want, taking opening a Word file as an examplelet wantInfo: Want {uri: file.uri, // Indicate the URI path of the file to be opened, usually used in conjunction with typetype: application/msword, // Indicate the type of file to be openedflags: wantConstant.Flags.FLAG_AUTH_WRITE_URI_PERMISSION, // Authorization to perform write operations on URI}// Call the startAbility interface to open fileslet context getContext(this) as common.UIAbilityContext;context.startAbility(wantInfo).then(() {console.info(分享成功);}).catch((err: BusinessError) {console.info(分享失败);})二、处理分享的内容 1. module.json5 配置可接收分享 在module.json5 下找到 abilities标签找到 skills 配置entities添加 entity.system.share entities: [entity.system.home,entity.system.share],配置actions,添加actions actions: [action.system.home,ohos.want.action.select,ohos.want.action.sendData,ohos.want.action.viewData // 必填声明数据处理能力],配置uris uris: [{scheme: file,// 物理存储类型的基类型utd: general.entity,maxFileSupported: 1,linkFeature: FileOpen},{scheme: file,// 逻辑内容类型的基类型utd: general.object,maxFileSupported: 1,linkFeature: FileOpen}]2. 解析分享的数据 在其onCreate或onNewWant回调中获取传入的want参数 onCreate(want: Want, launchParam: AbilityConstant.LaunchParam): void {this.context.getApplicationContext().setColorMode(ConfigurationConstant.ColorMode.COLOR_MODE_NOT_SET);// 注入Ability上下文到AppUtilsAppUtils.getInstance().context this.context;hilog.info(DOMAIN, testTag, %{public}s, Ability onCreate);ShareManager.getInstance().handelShareData(want);} onNewWant(want: Want, launchParam: AbilityConstant.LaunchParam): void {ShareManager.getInstance().handelShareData(want)}通过getSharedData 解析分享数据 /** 处理分享过来的文件 */public handelShareData(want: Want) {systemShare.getSharedData(want).then((data: systemShare.SharedData) {data.getRecords().forEach((record: systemShare.SharedRecord) {// 处理分享数据});}).catch((error: BusinessError) {DKLogger.error(Failed to getSharedData. Code: ${error.code}, message: ${error.message});// this.context.terminateSelf();if (want.action ohos.want.action.sendData|| want.action ohos.want.action.viewData) {}});}处理完分享数据即可将数据在页面显示
http://www.pierceye.com/news/345839/

相关文章:

  • 山东省建设工程质量监督网站广州软件合作中心
  • 郑州网站建设怎么样通州建设局网站
  • 免费网站建设福州怎么修改网站主页
  • 深圳企业建站设计公司wordpress不显示样式
  • 外贸网站商城广东省建设协会网站
  • 杭州制作企业公司网站wordpress数据库添加用户
  • 主域名进入网站广告标识标牌制作厂家
  • 网站建设基础流程摘要专题网站建设策划
  • 滁州网站建设电话网站建设与网站优化
  • 慈溪做网站公司哪家好淘宝商城的网站建设
  • 安徽建设厅网站怎么打不开太原网络搭建
  • idea 网站开发最好的免费推广平台
  • 专业排名优化网站怎么建网站教程视频app
  • 全国八大员报名官方网站支付宝小程序开发工具
  • 怎么查看vps网站服务器时间中国建设会计协会网站
  • 门户网站上的广告怎么做深圳服装网站建设
  • 公司网站上线的通知抚州营销型网站建设
  • 中国住房城乡和城乡建设部网站小广告文案
  • 做带字头像的网站wordpress 翻页设置
  • 网站横幅js代码公众号如何申请
  • 找网站建设需要问什么软件物联网平台功能
  • 含山县城市建设有限公司网站成都中高风险地区名单最新
  • 鄂州手机网站建设深圳seo网站设计
  • 网站内容的实现方式建筑设计人才招聘
  • 网站做优化效果怎样iis怎么做网站空间
  • 重庆市建设局网站郑州网站建设哪一家好
  • wordpress指定分类广告金融网站排名优化
  • 美妆网站建设方案陕西网络公司网站建设
  • 北京地铁建设的网站深圳建网站兴田德润可信
  • 平台门户网站建设企业战略规划方案