uniapp转发文章

// 转发微信 朋友圈
		transArticle(data, type) {
			
			let token=uni.getStorageSync(ACCESS_TOKEN);
			
			if (!token) {
				this.$tip.toast('请先登录')
				return
			}
			// 文章标题
			const contentTitle = data.title;
			const imageUrl = this.$config.apiUrl + '/' + data.imageHref;
			const summary = data.summary ? data.summary : '暂无简介';
			const href = `${this.$config.apiUrl}/articleDetail?articleId=${data.id}&title=${encodeURIComponent(contentTitle)}&imageUrl=${imageUrl}&summary=${summary}`;
			this.handleArticle(data, type)
			uniShare({
				content: { //公共的分享参数配置  类型(type)、链接(herf)、标题(title)、summary(描述)、imageUrl(缩略图)
					type: 0,
					href,
					title: contentTitle,
					summary,
					imageUrl,
				},
				menus: [
					{
						"img": "",
						"text": "微信好友",
						"share": { //当前项的分享参数配置。可覆盖公共的配置如下:分享到微信小程序,配置了type=5
								"provider": "weixin",
								"scene": "WXSceneSession"
						}
					},
					{
						"img": "",
						"text": "朋友圈",
						"share": {
							"provider": "weixin",
							"scene": "WXSenceTimeline"
						}
					}
				],
				cancelText: "",
			}, e => {
				console.log(e);
			})
		},
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值