分享组件
大约 1 分钟
引入
通过以下方式来全局注册组件,更多注册方式请参考Vue3-Base
说明。
const app = createApp()
const [ShareV5] = await VueBase.require(["nie.vue3.sharev5"]);
app.use(ShareV5);
app.mount("#app");
代码演示
<template>
<h2>1.分享组件示例1 小icon:</h2>
<feg-sharev5 :type="1" />
<h2>2.分享组件示例2 大icon:</h2>
<feg-sharev5 :type="2" />
<h2>3.右侧滚动条分享:</h2>
<feg-sharev5 :type="3" />
<h2>4.图片分享:</h2>
<img
class="test"
src="https://webinput.nie.netease.com/img/nie/logo.png/500"
/>
<feg-sharev5 :type="4" imgs="img.test" />
<h2>5.文本分享:</h2>
<p class="test">
选择我吧!选择我吧!选择我吧!选择我吧!选择我吧!
</p>
<feg-sharev5 :type="5" txt="p.test" />
<h2>6.分享组件示例3 带文字的icon:</h2>
<feg-sharev5 :type="6" />
</template>
API
Props
参数 | 说明 | 类型 | 默认值 |
---|---|---|---|
type | 分享组件类别,(1:小icon,2:大icon,3:右侧滚动条分享,4:图片分享,5:文本分享,6:带文字的小icon) | 1 | 2 | 3 | 4 | 5 | 6 | 1 |
defShow | 默认展示的分享按钮 | (1 | 2 | 23 | 24)[] | [23, 2, 1, 24] |
title | 分享的标题 | string | document.title |
url | 分享的链接 | string | window.location.href |
img | 分享的图片 | string | "" |
content | 分享的正文内容,只有部分平台支持。 | string | document.title |
imgs | 需要分享的图片,css选择器 | string | - |
txt | 需要分享的文本,css选择器 | string | - |
组件按钮参数
按钮 | 参数 |
---|---|
微信 | 23 |
易信 | 22 |
新浪微博 | 2 |
QQ空间 | 1 |
腾讯微博 | 3 |
人人网 | 8 |
QQ好友 | 24 |
豆瓣 | 11 |
百度贴吧 | 14 |