uniapp app中导出手机号码到通讯录

uniapp app中导出手机号码到通讯录

whq
whq
2021-12-08 / 0 评论 / 12 阅读 / 正在检测是否收录...
温馨提示:
本文最后更新于2021年12月08日,已超过1228天没有更新,若内容或图片失效,请留言反馈。
 var that = this
        plus.contacts.getAddressBook(plus.contacts.ADDRESSBOOK_PHONE, (addressbook) => {
          console.info('获取通信录对象成功')
          // console.info(addressbook)
          plus.contacts.getAddressBook(plus.contacts.ADDRESSBOOK_PHONE, (addressbook) => {
            // 向通讯录中添加联系人
            var contact = addressbook.create()
            console.info(that.shuju.length)

            for (let i = 0; i < that.shuju.length; i++) {
              console.info(i)

              contact.name = {
                givenName:   that.shuju[i].company
              }
              // for(let i1=0;i1<that.that.shuju[i].telphone;i1++){
              contact.phoneNumbers = [{
                type: '手机',

                value: that.shuju[i].mobile[0],
                preferred: true
              }]
              // }

              contact.save((res4) => {
                console.log()
                uni.$showMsg('导入成功', 'success')
                uni.$showMsg(res4)
                this.$refs.popup2.hide()
                this.duxuan = true
                that.api.msg("导入成功", 1)
              })
            }


          })
        })
2

评论

博主关闭了所有页面的评论