热门问题
待回答
最新问题
热门回答
  • 1

    回答

    810

    浏览
    HarmonyOS grid中item设置长按事件,在长按事件中怎么获取当前item的index

    获取的是item在grid中的角标,也就是位于第几个

    HarmonyOS
      Excelsior_abit 进行了回答 • 2025-01-09 17:12:55
  • 1

    回答

    967

    浏览
    HarmonyOS Tab组件嵌套使用时,子组件tap滑动到最后一个时候父组件Tap如何滑动到下一个

    Tab组件嵌套使用时,子组件tap滑动到最后一个时候父组件Tap如何滑动到下一个。如何达到图中的效果呢

    HarmonyOS
      Heiang 进行了回答 • 2025-01-09 17:12:52
  • 1

    回答

    786

    浏览
    HarmonyOS CustomDialogController使用问题

    想自定义一个弹窗组件,期望在使用时直接调用,但是在使用时发现CustomDialogController只能够在Componentstruct内部定义时赋值才有效,有什么其他方法实现吗?

    HarmonyOS
      shlp 进行了回答 • 2025-01-09 17:12:43
  • 1

    回答

    1027

    浏览
  • 1

    回答

    813

    浏览
    HarmonyOS popToName 时,祖先页面无法获取到result 参数返回的数据,只有父页面能获取

    A页面通过pushPathByName(name,param,onPop,animated),跳转到B页面,B页面在通过pushPathByName(name,param,animated)跳到C页面,在C页面通过popToName(name,result,animated)直接返回到A页面,此时A页面的onPop不会掉用。这个就是这样设计的还是bug?请问上述情况,如何从A直接回到C,如何获取C返回的数据?

    HarmonyOS
      FengTianYa 进行了回答 • 2025-01-09 17:12:22
  • 1

    回答

    702

    浏览
    HarmonyOS Array如何转成ArrayBuffer

    使用CryptoJS通用AES解密得到了一组Array,如何将其转为ArrayBuffer再保存为文件。

    HarmonyOS
      shlp 进行了回答 • 2025-01-09 17:12:15
  • 1

    回答

    727

    浏览
    HarmonyOS 怎么实现状态变量变化时,触发指定函数
    HarmonyOS
      aquaa 进行了回答 • 2025-01-09 17:12:11
  • 1

    回答

    788

    浏览
    HarmonyOS 关于侧滑返回的监听
    HarmonyOS
      Excelsior_abit 进行了回答 • 2025-01-09 17:11:56
  • 1

    回答

    1152

    浏览
    HarmonyOS 应用图标分层是指什么

    已按照要求实现logo图标,但是测试说是包中要能看到分层的两张图标,这块有相关指导吗当前logo是一张图标,通过上下分层的方式实现合成一张图提供的如下要求应用图标资源需分层,尺寸需满足规范要求:应用图标资源必须分为前景图和背景图两层,尺寸要求必须为1024px1024px,资源不允许自行裁切圆角,不允许在资源内添加内间距。参考:https:developer.huawei.comconsumercndocdesignguidesuxguidelinesgeneral0000001760708152

    HarmonyOS
      aquaa 进行了回答 • 2025-01-09 17:11:55
  • 1

    回答

    658

    浏览
    HarmonyOS 退到后台监听

    app退到可运行后台监听,例如图片中效果的,要怎么监听到,onBackground监听不到,onBackground只有app完全不可见的时候可以监听,但是如果我手动,慢慢的把app推到可运行后台,这个时候app界面还是可见,只是小窗口,这个时候监听不到

    HarmonyOS
      aquaa 进行了回答 • 2025-01-09 17:11:50
  • 1

    回答

    625

    浏览
    HarmonyOS List组件滑动限制为1页的问题

    现在有一个List,做图片预览。现在存在问题,滑动页面的时候,会一下滑动超过一页。代码如下所示Stack({alignContent:Alignment.Bottom}){显示的列表List(){LazyForEach(this.mViewModel.getDataSource(),(item:MediaVo,index:number){if(item.typeMediaType.IMAGE){ImageVH({mVo:item,mViewModel:this.mViewModel})}elseif(item.typeMediaType.VIDEO){}},(item:MediaVo,index:number):string{returnitem.generateKey(index);})...

    HarmonyOS
      Heiang 进行了回答 • 2025-01-09 17:11:45
  • 1

    回答

    942

    浏览
    HarmonyOS 在Worker线程中如何创建一个RdbStore对象

    1.主线程中创建Store对象,这个代码可以正常创建出来2.Worker中无法创建出来,主要是那个getContext()方法调用会block住;relationalStore.getRdbStore(getContext(),config,(err,store){获取到Store})getContext()会引用到common.d.ts里面的代码declarefunctiongetContext(component:Object):Context;

    HarmonyOS
      zbw_apple 进行了回答 • 2025-01-09 17:10:46
  • 1

    回答

    716

    浏览
    HarmonyOS 控件显示或者隐藏,采用if判断或者Visibility.Visible哪个性能更高

    控件显示或者隐藏,采用if判断或者Visibility.Visible哪个性能更高代码片段如下if(this.isShow){Text('测试文本1').width(100).height(60)}Text('测试文本2').width(100).height(60).visibility(this.isShowVisibility.Visible:Visibility.Hidden)Button('点击测试').onClick((){this.isShowtrue;})

    HarmonyOS
      Heiang 进行了回答 • 2025-01-09 17:10:36
  • 1

    回答

    971

    浏览
    HarmonyOS 对方法使用装饰器方法内部的this引用会变成undefine

    exportfunctionBRBridge(target:Object,key:string,descriptor:PropertyDescriptor){constoriginalMethod:Functiondescriptor.valuedescriptor.value(...args:Object[]){letresult:FunctionoriginalMethod(...args)returnresult}returndescriptor}使用场景是exportclassCommonBridge{proxy:IWebViewControllerProxy;constructor(webviewControllerProxy:IWebViewControllerProxy){this.proxywebviewControllerProxy;}BRBridgeas...

    HarmonyOS
      zbw_apple 进行了回答 • 2025-01-09 17:10:36
  • 1

    回答

    852

    浏览
    HarmonyOS TabContent架构下实现沉浸式,设置 .expandSafeArea不生效

    Tabs,TabContent架构下实现沉浸式,通过下面的方式([SafeAreaType.SYSTEM],[SafeAreaEdge.TOP,SafeAreaEdge.BOTTOM])不会生效。

    HarmonyOS
      aquaa 进行了回答 • 2025-01-09 17:10:34
  • 1

    回答

    751

    浏览
    HarmonyOS 重载函数类型的变量报错

    重载函数类型的变量报错:"SyntaxError:Unexpectedsuperkeyword[:1:6],Thesizeofprogramsisexpectedtobe1,butis0."示例代码:exportclassBase{log:()void(){console.log('loglog')}}exportclassHelloextendsBase{log:()void(){super.log()}}newHello().log()报错。

    HarmonyOS
      zbw_apple 进行了回答 • 2025-01-09 17:10:26
  • 1

    回答

    899

    浏览
    HarmonyOS 数组监听问题

    前提:已经通过ObservedObjectLink装饰相关classTabContent(){this.tableList(this.model.validSortList[])}BuildertableList(list:PolicyList[]){Column(){Row(){Text('有效保单'+list.length)}}}此时this.model.validSortList改变的时候list监听不到改变Column(){Row(){Text('有效保单'+this.model.validSortList.length)}}直接取this.model.validSortList是能监听到改变这种情况是什么引起的呢

    HarmonyOS
      zxjiu 进行了回答 • 2025-01-09 17:10:24
  • 1

    回答

    1131

    浏览
    HarmonyOS Swiper滑动性能优化

    Swiper快速滑动,onGestureSwipe第一次执行和onAnimationStart执行间隔有时能达到100200ms,这一部分是系统导致的还是业务代码导致的劣化,有什么优化方案吗

    HarmonyOS
      superinsect 进行了回答 • 2025-01-09 17:10:17
  • 1

    回答

    1016

    浏览
    HarmonyOS toast不显示问题

    staticshowToast(message:stringResource,options:ToastOptions){if((typeofmessage'string'&&message.length0)message){if(!options){optionsnewToastOptions()}promptAction.showToast({message:message,duration:options.duration,bottom:options.bottom,showMode:options.showMode})}}如上代码我封装了一个showToast的方法,该方法有时候会显示不出来,这个是什么原因造成的昵?而且我试了调用该方法不显示,直接在调用的地方使用promptAction.showToas能显示,是否在封装的时候上下文不匹配??

    HarmonyOS
      superinsect 进行了回答 • 2025-01-09 17:10:16
  • 1

    回答

    714

    浏览
    HarmonyOS 如何使用c++获取父进程id
    HarmonyOS
      put_get 进行了回答 • 2025-01-09 17:10:15
  • 1

    回答

    879

    浏览
    HarmonyOS ArkTS直接调用js时,系统是否会进行限制
    HarmonyOS
      put_get 进行了回答 • 2025-01-09 17:10:07
  • 1

    回答

    596

    浏览
    HarmonyOS hsp的index文件里面的方法参数名都丢了
    HarmonyOS
      fox280 进行了回答 • 2025-01-09 17:10:01
  • 1

    回答

    844

    浏览
    HarmonyOS List组件超长列表加载延迟的问题

    代码层级如下:List({scroller:this.listScroller}){ForEach(this.groupMap,(groupInfo:WordGroupItem,groupIndex:number){ListItemGroup({header:this.itemGroup(groupInfo)}){LazyForEach(groupInfo[1],(item:WordModel,index:number){ListItem()WordListChild()}}}}目前group有20项,每个group中有5000个子项,现象:加载时候数据组装完成到第一个WordListChild的aboutToAppear(),有1秒多的延迟。15:51:32.897A007E8WordLis...

    HarmonyOS
      zbw_apple 进行了回答 • 2025-01-09 17:09:54
  • 1

    回答

    949

    浏览
    HarmonyOS 构造传参数失败问题

    TabBar.etsbuild(){Tabs({barPosition:BarPosition.Start}){ForEach(this.tabBarArray,(tabsItem:ChannelModel[],index:number){TabContent(){HomeNewsListView({tabItem:tabsItem[index]});构造传参数}.tabBar(this.TabBuilder(index,index)).....................................HomeNewsListView.etsComponentexportstructHomeNewsListView{privaterefreshtype:string"1"1下拉刷新2上拉加载privaterefreshcount:number1第几...

    HarmonyOS
      zbw_apple 进行了回答 • 2025-01-09 17:09:45
  • 1

    回答

    736

    浏览
    HarmonyOS 如何在层级深的component中获取当前页面的localstorage.

    在开发过程中,需要使用到LocalStorage组件,LocalStorage组件需要Entry标识的页面创建,但是使用的地方可能是层级较深的自定义组件中,请问在自定义组件中,能否有什么系统方法能够获取当前页面的LocalStorage.一层一层的传递,感觉太繁琐了。

    HarmonyOS
      fox280 进行了回答 • 2025-01-09 17:09:23
  • 1

    回答

    955

    浏览
    HarmonyOS 手机开发APP,ArkTS 中如何获取触摸点的屏幕显示坐标

    目前开发一款手机APP,在使用swiper等组件,如何在用户触屏时,获取到触摸点坐标,进行存储?

    HarmonyOS
      FengTianYa 进行了回答 • 2025-01-09 17:09:17
  • 1

    回答

    794

    浏览
    HarmonyOS反射该怎么写
    HarmonyOS
      put_get 进行了回答 • 2025-01-09 17:09:15
  • 1

    回答

    847

    浏览
    HarmonyOS FrameNode手势检测crash

    自定义FrameNode创建PanGesture对象,实际返回的是undifined,调用onActionStart方法crashimport{FrameNode,NodeController,UIContext}from'kit.ArkUI'classMyNodeControllerextendsNodeController{makeNode(uiContext:UIContext):FrameNodenull{letframeNodenewFrameNode(uiContext);frameNode.commonAttribute.gesture(PanGesture({direction:PanDirection.Vertical}).onActionStart(e{console.log(PanGestureonActionStart)}...

    HarmonyOS
      shlp 进行了回答 • 2025-01-09 17:09:08
  • 1

    回答

    810

    浏览
  • 1

    回答

    747

    浏览
    HarmonyOS Record或者Map保存的数据改变,页面没有刷新

    通过Record或者Map通keyvalue保存的数据,数据改变了页面没有刷新,且key值是后台返回的数据,然后根据key又去后台请求value的数据,value是模型数组数据然后进行保存,通过上拉刷新value的模型数组数据增加,但页面未刷新。

    HarmonyOS
      put_get 进行了回答 • 2025-01-09 17:08:50
3.8w问题, 4.1w人参与
94%的提问收到了回答

优秀答主

  • 回答了3个问题,0个赞同
  • 回答了3个问题,0个赞同
  • 回答了3个问题,1个赞同
  • 回答了2个问题,0个赞同
  • 回答了2个问题,1个赞同
  • 写回答 帮助更多的人