提交 1b2d5cf7 编写于 作者: zhaofengliang920817's avatar zhaofengliang920817

修改share示例

上级 0ab86727
......@@ -3,12 +3,15 @@
<button class="button" @click="shareText()">分享文本</button>
<button class="button" @click="shareLink()">分享链接</button>
<button class="button" @click="sharePrivateImg()">分享单个本地图片</button>
<button class="button" @click="sharePrivateErrorImg()">分享单个本地图片(错误路径)</button>
<button class="button" @click="sharePrivateImgs()">分享多个本地图片</button>
<button class="button" @click="sharePrivateErrorImgs()">分享多个本地图片(含有错误路径)</button>
<button class="button" @click="shareAll()">分享链接、文本、多张图片</button>
<button class="button" @click="sharePubImg()">选择图片并分享</button>
<button class="button" @click="shareSnapShot()">指定view截图并分享</button>
<button class="button" @click="shareAll()">分享链接、文本、一张图片</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="warn" @click="sharePubImg()">选择图片并分享</button>
<button class="button" type="warn" @click="shareSnapShot()">指定view截图并分享</button>
</view>
</template>
......@@ -64,6 +67,25 @@
}
})
},
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";
......@@ -164,13 +186,9 @@
},
shareAll() {
uni.hideToast()
const errorImageSrc1 : string = "/static/test-image/logo.jpg1";
const errorImageSrc2 : string = "/static/test-image/logo.jpg1";
const imageSrc : string = "/static/test-image/logo.jpg";
const imageSrc : string = "/static/test-video/fast-forward.png";
let imageUrlList : string[] = Array()
imageUrlList.push(imageSrc)
imageUrlList.push(errorImageSrc1)
imageUrlList.push(errorImageSrc2)
uni.shareWithSystem({
summary: this.summary,
href: 'https://uniapp.dcloud.io',
......@@ -227,7 +245,7 @@
uni.getElementById("viewshot")?.takeSnapshot(
{
success: function (res) {
// #ifdef APP-ANDROIDn
// #ifdef APP-ANDROID
// 打印截图文件临时路径
console.log(res.tempFilePath)
const context = UTSAndroid.getUniActivity()!;
......@@ -280,6 +298,7 @@
<style>
.button {
margin: 15px;
margin: 20px;
margin-bottom: 0px;
}
</style>
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册