1.自定义分享按钮
<button open-type="share" @click="share()">发名片</button>
share(){
let that=this
uni.share({
title: '名片',
path: '/page2/me/card/sharecard?phone='+that.formData.phone, // 分享页面路径
// imageUrl: '/static/share.jpg', // 分享图片路径
success: function () {
uni.showToast({
title: '分享成功',
icon: 'success'
});
},
fail: function (error) {
uni.showToast({
title: '分享失败: ' + error.errMsg,
icon: 'none'
});
}
});
},
open-type="share" 必须加
2 uniapp 保存联系方式
baocundianhua() {
let _this = this
uni.addPhoneContact({
nickName: '卢律师',
firstName: '卢力华',
remark: '卢律师',
mobilePhoneNumber: '18092230666',
email:'lulihua@zlwd.com',
workAddressCountry:'中国大陆',
workAddressStreet:'陕西省西安市高新区绿地中心B座36层',
success: function() {
console.log('success');
uni.showToast({
title: '添加成功',
icon: 'success',
duration: 2000
})
},
fail: function() {
console.log('fail');
uni.showToast({
title: '添加失败',
icon: 'success',
duration: 2000
})
}
});
}