// 分享网页
/*
url为图标地址,
href为所分享的网页链接地址,
title为所分享网页的标题
description为所分享内容备注
*/
function shareWeb(url, href, title, description) {
var msg = {
type: 'web',
thumbs: [url]
};
if(!href) {
plus.nativeUI.alert('请输入分享网页的链接地址!');
//web_href.focus();
return;
}
msg.href = href;
if(!title) {
plus.nativeUI.alert('请输入分享网页的标题!');
//web_title.focus();
return;
}
msg.title = title;
/*if(!description) {
plus.nativeUI.alert('请输入分享网页的描述!');
web_content.focus();
return;
}*/
msg.content = description;
sweixin ? plus.nativeUI.actionSheet({
title:title,
cancel: '取消',
buttons: buttons
}, function(e) {
(e.index > 0) && share(sweixin, msg, buttons[e.index - 1]);
}) : plus.nativeUI.alert('当前环境不支持微信分享操作!');
}

本文介绍了一个用于分享网页的函数,详细解释了如何通过输入图标地址、网页链接、标题和描述来分享内容。函数首先检查必填字段是否完整,然后通过调用特定的分享接口完成分享过程。
724

被折叠的 条评论
为什么被折叠?



