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

网站文风17模板网网页

网站文风,17模板网网页,建筑企业网站要简约大气吗,5566网址大全设首页1、HarmonyOS 应用新建子窗口设置显示方向未生效#xff1f; 子窗口getPreferredOrientation获取到的是横向 设置没问题#xff0c;但是ui显示还是纵向的 直接设置主窗口的方向即可。参考demo#xff1a; import window from ohos.window;Entry Component struct Index {…1、HarmonyOS 应用新建子窗口设置显示方向未生效 子窗口getPreferredOrientation获取到的是横向 设置没问题但是ui显示还是纵向的 直接设置主窗口的方向即可。参考demo import window from ohos.window;Entry Component struct Index {State message: string Hello World;build() {Row() {Column() {Text(反向横屏).fontSize(50).fontWeight(FontWeight.Bold).onClick(async (){try {const topWindow await window.getLastWindow(getContext(this));console.info(Succeeded in obtaining the top window. Data: JSON.stringify(topWindow));await topWindow.setPreferredOrientation(window.Orientation.LANDSCAPE_INVERTED);console.info(Succeeded in setting window orientation.);} catch (error) {console.error(Failed to obtain or set the top window. Cause: JSON.stringify(error));}/*window.getLastWindow(getContext(this),(err,win){win.setPreferredOrientation(window.Orientation.LANDSCAPE_INVERTED)})*/})Text(竖屏).fontSize(50).fontWeight(FontWeight.Bold).onClick(async (){try {const topWindow await window.getLastWindow(getContext(this));console.info(Succeeded in obtaining the top window. Data: JSON.stringify(topWindow));await topWindow.setPreferredOrientation(window.Orientation.PORTRAIT);console.info(Succeeded in setting window orientation.);} catch (error) {console.error(Failed to obtain or set the top window. Cause: JSON.stringify(error));}/*window.getLastWindow(getContext(this),(err,win){win.setPreferredOrientation(window.Orientation.PORTRAIT)})*/})}.width(100%)}.height(100%)} }2、HarmonyOS RichEditor 内容不居中显示 参考代码 RichEditor({ controller: this.controllerRich}).width(100%).height(40).layoutWeight(1).borderRadius(10).backgroundColor(Color.Red).margin({ top: 20 ,left:14,bottom:5}).key(RichEditor).id(id).placeholder(平台提倡文明用语请温柔发言哦~,{font:{size:12},fontColor:#999999}).defaultFocus(true).onReady(() {this.controllerRich.addTextSpan(0123456789\n, {style: {fontColor: Color.Pink,fontSize: 32,},paragraphStyle: {textAlign: TextAlign.Center,leadingMargin: 16}})})3、HarmonyOS injectOfflineResources与precompileJavaScript区别 相较于precompileJavaScript injectOfflineResources也是指的把本地资源文件作为缓存给web使用吗底层实现有区别吗哪种性能会更好一些 injectOfflineResources将本地离线资源注入到内存缓存中以提升页面首次启动速度precompileJavaScript预编译JavaScript生成字节码缓存或根据提供的参数更新已有的字节码缓存这两个接口无论从用途、定义还是底层实现都完全是两个接口前者是将资源注入到内存缓存后者是将js编译成字节码缓存性能上也没有可比性参考链接https://developer.huawei.com/consumer/cn/doc/harmonyos-references-V5/js-apis-webview-V5#ZH-CN_TOPIC_0000001930676933__precompilejavascript12 4、HarmonyOS 在ArkTS中想要将JSON 转为Class后Class 中的function 方法丢失了 语法问题JSON.parse() 方法返回的是一个普通对象而不是 DataBean 类的实例。不包含类定义的任何方法。需要在将 JSON 数据转换为 DataBean 实例时手动创建类的实例并将 JSON 对象的属性赋值给类的实例。参考 class DataBean {code -1;msg ;isOK() {return this.code 0;}// 静态方法从 JSON 字符串创建 DataBean 实例static fromJson(jsonString: string): DataBean {const jsonData:ESObject JSON.parse(jsonString);const dataBean new DataBean();dataBean.code jsonData.code;dataBean.msg jsonData.msg;return dataBean;} }let json {code:0,msg:success}; let dataBean DataBean.fromJson(json); console.log(test,dataBean.msg); // success console.log(test,dataBean.isOK()); // true5、HarmonyOS 使用state装饰器监听Array数组对象中的属性如果不通过增删改的方式想监听属性有没有最佳实践 可以通过Observed装饰器和ObjectLink装饰器 嵌套类对象属性变化参考链接 https://developer.huawei.com/consumer/cn/doc/harmonyos-guides-V5/arkts-observed-and-objectlink-V5#%E5%AF%B9%E8%B1%A1%E6%95%B0%E7%BB%84 demo: Observed class InnerMessageVo {id?: number;readState?: boolean;constructor(id: number, readState: boolean) {this.id id;this.readState readState;} }Component struct ViweA {ObjectLink a: InnerMessageVo;build() {Row() {Text(${this.a.readState})}} }Entry Component struct Index {State arr1: InnerMessageVo[] [new InnerMessageVo(1, false), new InnerMessageVo(2, false)]build() {Row() {Column() {List() {ForEach(this.arr1, (item: InnerMessageVo, index: number) {ViweA({ a: this.arr1[index] })})ListItem() {Button(change).onClick(() {console.log(false);this.arr1[1].readState true})}}}.width(100%)}.height(100%)} }
http://www.tj-hxxt.cn/news/134463.html

相关文章:

  • 宁波 做网站网站怎么做搜索栏
  • 球队排名榜实时排名泰安seo推广
  • 营销型企业网站功能柳州哪家网站建设专业
  • 室内设计网站模板app搭建要多少钱
  • 山东省建设厅电工证查询网站qq互联网站备案号
  • 专业中山建网站公司做网站的名字大全
  • 徐州发布最新消息seo提升排名技巧
  • 给小孩子做网站手机助手
  • 瑜伽 网站模板网站建设简洁
  • ssh精品课程网站开发wordpress数据库压力
  • pc网站建设怎么做清远哪里有网页设计培训学费
  • 网站建设应该注意的设计要点微网站模板源代码
  • 网站免费广告湖南常德通报1例复阳病例
  • 网站建设的网络做网站后期维护工资贴吧
  • 深圳网站设计兴田德润放心石家庄网站建设蓝龙
  • 网站推广途径和方案腾讯企业邮箱忘记密码
  • 电子商务网站数据库怎么做霸县网站建设
  • 做qq主题的网站设计之路 网站
  • 石家庄建行网站wordpress 片刻主题
  • 如何制作网站教程视频讲解新乡专业网站制作
  • 百度怎么不收录我的网站最新新闻事件今天300字
  • 直播网站开发源码下载中国家具网
  • 职高网站建设例题上海知名网站制作公司
  • 网站内容有什么特点图片设计制作软件下载
  • 织梦网站模板还原的文件在哪里赣州人才网招聘找工作
  • 珠海知名网站青柠影院免费观看电视剧高清8
  • 做视频网站要什么格式好新问网站设计
  • 专业网站制作解决方案深圳航空公司官网
  • 网站关键词怎么优化排名国外大气网站设计
  • 网站后台编辑器控件下载厦门网站建设 金猪