百度官方文档: http://share.Baidu.com/code/advance # toid
在线demo:https://my.weblf.cn/xly/demo/web _ share.html
首先导入外部文件:
with (文档)0) (getelementsbytagname('head ) ) (|body ).appendchild (createelement ) (script ' ) ).sreatelel 此代码自动加载js和css。
而且我们需要dom树
divclass=' bdsharebuttonbox ' data-tag=' share _1' aclass=' BDS _ mshare ' data-cmd=' mshare '/aa class=' bare aa class=' b aa class=' BDS _ tsina ' data-cmd=' tsina '/aa class=' BDS _ Baidu ' data-cmd=' Baidu '/aa class=aclass=' BDS _ more ' data-cmd=' more '更多/aa class=' BDS _ count ' data-cmd=' count '/a/div这个a标签写地址吗
我们实现了简单的共享功能:
window._bd_share_config={
' common' : {
' bdText' : '这是共享的标题',
' bdComment' : '我有一个共同的共享设置,用于说明发送给QQ朋友',
' BD pic ' : ' http://test.miniwangdai.com/public/images/invite/we chat.png ',//共享的图像地址
' bdStyle' : '0',//按钮样式
' bdSize' : '32 ',//按钮大小
' bdUrl' : 'https://www.baidu.com ',//共享的地址
' bdDesc': '给你的朋友留一句话吧',
(,
' share' : {},
(;
这样就有了最简单的共享功能。
效果: