19302com
19302com
  • 发布:2025-02-08 11:33
  • 更新:2025-02-08 11:33
  • 阅读:12

【报Bug】uniapp编译成鸿蒙后,使用@pura/harmony-utils插件拉起短信,手机号码带不过来,同样代码原生可以带过去

分类:uni-app

产品分类: uniapp/App

PC开发环境操作系统: Windows

PC开发环境操作系统版本号: win11

HBuilderX类型: 正式

HBuilderX版本号: 4.51

手机系统: HarmonyOS NEXT

手机系统版本号: HarmonyOS NEXT Developer Preview

手机厂商: 华为

手机机型: mate 60 pro

页面类型: vue

vue版本: vue3

打包方式: 云端

项目创建方式: HBuilderX

示例代码:

uts插件写法

import { DeviceUtil, AppUtil, NotificationUtil, WantUtil, ToastUtil  } from '@pura/harmony-utils';  
// 打开短信  
export function openHmMMS (phone: string, name: string) : void {  
    console.log('打开的短信号码--------------------------->:', phone, name)  

    WantUtil.startMMS("13909626520", "张三").then(() => {  
        ToastUtil.showToast("拉起短信界面…")  
    }).catch((err: BusinessError) => {  
        console.log(JSON.stringify(err));  
        ToastUtil.showToast("拉起失败!");  
    });  
}

//鸿蒙原生写法

import { FileUtil, LogUtil, ToastUtil, WantUtil } from '@pura/harmony-utils';  
import { BusinessError } from '@kit.BasicServicesKit';  

@Entry  
@Component  
struct Index {  
  @State message: string = 'Hello World';  

  build() {  
    RelativeContainer() {  
      Button("startMMS()")  
        .btnStyle()  
        .onClick(() => {  
          WantUtil.startMMS("13909626520", "张三").then(() => {  
            ToastUtil.showToast("拉起短信界面…")  
          }).catch((err: BusinessError) => {  
            LogUtil.error(JSON.stringify(err));  
            ToastUtil.showToast("拉起失败!");  
          });  
        })  
    }  
    .height('100%')  
    .width('100%')  
  }  
}  

@Styles  
function btnStyle() {  
  .width('90%')  
  .margin({ top: 10, bottom: 5 })  
}

操作步骤:

点击按钮,打开短信APP,默认填上手机号码

预期结果:

点击按钮,打开短信APP,默认填上手机号码

实际结果:

uts插件开发后,打开手机号带不上去,鸿蒙原生可以带上去

bug描述:

uniapp编译成鸿蒙后,使用@pura/harmony-utils插件拉起短信,手机号码带不过来,同样代码原生可以带过去

2025-02-08 11:33 负责人:无 分享
已邀请:

要回复问题请先登录注册