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 })  
}                                    
            
            
            

            
19302com (作者)
之前用鸿蒙的api,也是可以调起短信,手机号码没带过去……
2025-02-08 16:44
19302com (作者)
还用这个包做了别的功能哩,别的功能跑着没问题
2025-02-08 16:46
19302com (作者)
回复 19302com: 也是uts里面写的
2025-02-08 16:47
DCloud_UNI_yuhe
回复 19302com: 手机号码带不过去是什么意思,传递参数吗?
2025-02-08 16:48
19302com (作者)
回复 DCloud_UNI_yuhe: 这个不能加附件,我回复到下面了
2025-02-08 16:58
19302com (作者)
回复 DCloud_UNI_yuhe: 大佬大佬,咋样,十万火急
2025-02-08 17:35