選擇本地系統通信錄中某個聯繫人的電話方法:my.choosePhoneContact
代碼示例:
my.choosePhoneContact({
success: (res) => {
my.alert({
\t content: '姓名:' + res.name + '\\n號碼:' + res.mobile
\t});
},
});
喚起支付寶通訊錄,選擇一個或者多個支付寶聯繫人:my.chooseAlipayContact
代碼示例:
my.chooseAlipayContact({
count: 2,
success: (res) => {
my.alert({
content: 'chooseAlipayContact response: ' + JSON.stringify(res)
});
},
fail: (res) => {
my.alert({
content: 'chooseAlipayContact response: ' + JSON.stringify(res)
});
}
});
注:返回的 mobile 和 email 字段不一定全有值,取決於所選取聯繫人的支付寶賬號類型是手機號還是郵箱
喚起選人組件:my.chooseContact
代碼示例:
my.chooseContact({
chooseType: 'multi', // 多選模式
includeMe: true, // 包含自己
includeMobileContactMode: 'known',//僅包含雙向手機通訊錄聯繫人,也即雙方手機通訊錄都存有對方號碼的聯繫人
multiChooseMax: 3, // 最多能選擇三個聯繫人
multiChooseMaxTips: '超過選擇的最大人數了',
success: (res) => {
my.alert({
content: 'chooseContact : ' + JSON.stringify(res)
});
},
fail: (res) => {
my.alert({
content: 'chooseContact : ' + JSON.stringify(res)
});
}
});
閱讀更多 創業老男孩 的文章