Skip to content

获取手机通讯录

方法名

getContacts

用法

  • 用法如下:
    js
    module.getContacts({
      //手机号码,可以为空
      phoneNumber: "",
      //姓名
      name: "胡"
    }, res => {
      this.writeLog(JSON.stringify(res))
    });
  • 参数说明
    参数名参数类型是否必填默认值参数描述
    phoneNumberString搜索的电话号码
    nameString搜索姓名,模糊搜索

回调

  • 示例
    json
    {
      "data": {
        "list": [
          {
            "name": "胡1",
            "phoneNumber": "18671211111"
          },
          {
            "name": "胡2",
            "phoneNumber": "13471111111"
          }
        ]
      },
      "message": "",
      "code": 0
    }
  • 回调说明:
    参数名参数类型参数描述
    messageString消息提示
    dataObject数据对象
    data.nameString姓名
    data.phoneNumberString电话
    codeInteger返回类型,0.成功,其他:失败