- getContacts: function() {
- var that = this;
- //获取通讯录对象
- plus.contacts.getAddressBook( plus.contacts.ADDRESSBOOK_PHONE, function( addressbook ) {
- uni.showToast({
- title: '获取通讯录对象成功',
- duration: 2000
- })
- console.log('获取通讯录对象成功')
- console.log(addressbook)
- // 查找联系人
- addressbook.find(["displayName","phoneNumbers"],function(contacts){
- uni.showToast({
- title: '获取联系人成功',
- duration: 2000
- })
- console.log('获取联系人成功')
- console.log(JSON.stringify(contacts))
- that.list = contacts
- }, function () {
- uni.showToast({
- title: '获取联系人失败',
- duration: 2000
- })
- },{multiple:true});
- }, function ( e ) {
- uni.showToast({
- title: '获取通讯录对象失败:' + e.message,
- duration: 2000
- })
- });
- },