提交 e76ece07 编写于 作者: M mahaifeng

[share]添加系统分享示例

上级 9d6ee5c3
......@@ -15,7 +15,6 @@
<button class="button" @click="sharePrivateFile()">分享文件(单个)</button>
<button class="button" @click="sharePrivateFiles()">分享文件(多个)</button>
<button class="button" type="primary" @click="shareErrorLink()">分享链接(格式错误)</button>
<button class="button" type="primary" @click="sharePrivateErrorImg()">分享单个本地图片(错误路径)</button>
<button class="button" type="primary" @click="sharePrivateErrorImgs()">分享多个本地图片(含有错误路径)</button>
<button class="button" type="primary" @click="sharePrivateErrorVideos()">分享Video文件(错误路径)</button>
......@@ -23,7 +22,7 @@
<button class="button" type="primary" @click="sharePrivateErrorFiles()">分享文件(错误路径)</button>
<button class="button" type="warn" @click="sharePubImg()">选择图片并分享</button>
<button class="button" type="warn" @click="sharePubMedias()">选择media并分享</button>
<button class="button" type="warn" @click="sharePubMedias()">选择video并分享</button>
<button class="button" type="warn" @click="shareSnapShot()">指定view截图并分享</button>
</view>
</scroll-view>
......@@ -44,6 +43,7 @@
uni.shareWithSystem({
audioPaths: [path1, path2],
type:'audio',
success(res) {
console.log('Shared----------------------------success')
},
......@@ -66,7 +66,8 @@
const path2 : string = "/static/filemanager/11.txt.br";
uni.shareWithSystem({
filePaths: [path1, path2],
filePaths: [path1, path2],
type:'file',
success(res) {
console.log('Shared----------------------------success')
},
......@@ -87,7 +88,8 @@
const path1 : string = "/static/filemanager/to.zip";
uni.shareWithSystem({
filePaths: [path1],
filePaths: [path1],
type:'file',
success(res) {
console.log('Shared----------------------------success')
},
......@@ -109,7 +111,8 @@
const path2 : string = "/static/filemanager/1.txt.br";
uni.shareWithSystem({
filePaths: [path1, path2],
filePaths: [path1, path2],
type:'file',
success(res) {
console.log('Shared----------------------------success')
},
......@@ -130,7 +133,8 @@
const path1 : string = "/static/test-audio/ForElise.mp3";
uni.shareWithSystem({
audioPaths: [path1],
audioPaths: [path1],
type:'audio',
success(res) {
console.log('Shared----------------------------success')
},
......@@ -152,7 +156,8 @@
const path2 : string = "/static/test-audio/ForElise.mp3";
uni.shareWithSystem({
audioPaths: [path1, path2],
audioPaths: [path1, path2],
type:'audio',
success(res) {
console.log('Shared----------------------------success')
},
......@@ -174,7 +179,8 @@
const path2 : string = "/static/test-video/10second-demo1.mp4";
uni.shareWithSystem({
videoPaths: [path1, path2],
videoPaths: [path1, path2],
type:'video',
success(res) {
console.log('Shared----------------------------success')
},
......@@ -195,7 +201,8 @@
uni.hideToast()
const path1 : string = "/static/test-video/10second-demo.mp4";
uni.shareWithSystem({
videoPaths: [path1],
videoPaths: [path1],
type:'video',
success(res) {
console.log('Shared----------------------------success')
},
......@@ -218,7 +225,8 @@
const path2 : string = "/static/test-video/10second-demo.mp4";
uni.shareWithSystem({
videoPaths: [path1, path2],
videoPaths: [path1, path2],
type:'video',
success(res) {
console.log('Shared----------------------------success')
},
......@@ -241,7 +249,8 @@
uni.chooseVideo({
success(res) {
uni.shareWithSystem({
videoPaths: [res.tempFilePath],
videoPaths: [res.tempFilePath],
type:'video',
success(res) {
console.log('Shared----------------------------success')
},
......@@ -263,7 +272,8 @@
shareText() {
uni.hideToast()
uni.shareWithSystem({
summary: this.summary,
summary: this.summary,
type:'text',
success(res) {
console.log('Shared----------------------------success')
},
......@@ -281,7 +291,8 @@
},
shareLink() {
uni.hideToast()
uni.shareWithSystem({
uni.shareWithSystem({
type:'text',
href: 'https://uniapp.dcloud.io',
success(res) {
console.log('Shared----------------------------success')
......@@ -298,29 +309,11 @@
}
})
},
shareErrorLink() {
uni.hideToast()
uni.shareWithSystem({
href: 'htp:11',
success(res) {
console.log('Shared----------------------------success')
},
fail(res) {
console.log('Share failed, ' + "res.errCode =" + res.errCode + '---res.errMsg= ' + res.errMsg)
uni.showToast({
icon: "error",
title: "errorCode=" + res.errCode
})
},
complete(res) {
}
})
},
sharePrivateImg() {
uni.hideToast()
const imageSrc : string = "/static/test-image/logo.gif";
uni.shareWithSystem({
uni.shareWithSystem({
type:'image',
imageUrl: imageSrc,
success(res) {
console.log('Shared----------------------------success')
......@@ -343,7 +336,8 @@
uni.hideToast()
const imageSrc : string = "/static/test-image/logo.jpg11";
uni.shareWithSystem({
imageUrl: imageSrc,
imageUrl: imageSrc,
type:'image',
success(res) {
console.log('Shared----------------------------success')
// 分享完成,请注意此时不一定是成功分享
......@@ -369,10 +363,11 @@
let imageUrlList : string[] = Array()
imageUrlList.push(errorImageSrc2)
imageUrlList.push(imageSrc)
imageUrlList.push(errorImageSrc1)
// imageUrlList.push(errorImageSrc1)
uni.shareWithSystem({
imagePaths: imageUrlList,
imagePaths: imageUrlList,
type:'image',
success(res) {
console.log('Shared----------------------------success')
// 分享完成,请注意此时不一定是成功分享
......@@ -399,7 +394,8 @@
imageUrlList.push(errorImageSrc1)
imageUrlList.push(errorImageSrc2)
uni.shareWithSystem({
imagePaths: imageUrlList,
imagePaths: imageUrlList,
type:'image',
success(res) {
console.log('Shared----------------------------success')
// 分享完成,请注意此时不一定是成功分享
......@@ -424,7 +420,8 @@
uni.shareWithSystem({
summary: this.summary,
href: 'https://uniapp.dcloud.io',
imagePaths: imageUrlList,
imagePaths: imageUrlList,
type:'image',
success(res) {
console.log('Shared----------------------------success')
// 分享完成,请注意此时不一定是成功分享
......@@ -452,7 +449,8 @@
uni.shareWithSystem({
// summary: "aa",
// href: 'https://uniapp.dcloud.io',
imagePaths: e.tempFilePaths,
imagePaths: e.tempFilePaths,
type:'image',
success(res) {
console.log('Shared----------------------------success')
// 分享完成,请注意此时不一定是成功分享
......@@ -478,7 +476,8 @@
{
success: function (res) {
uni.shareWithSystem({
imageUrl: res.tempFilePath,
imageUrl: res.tempFilePath,
type:'image',
success(res) {
console.log('Shared----------------------------success')
// 分享完成,请注意此时不一定是成功分享
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册