Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
DCloud
hello uni-app x
提交
a6f84482
H
hello uni-app x
项目概览
DCloud
/
hello uni-app x
通知
5995
Star
90
Fork
162
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
18
列表
看板
标记
里程碑
合并请求
1
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
H
hello uni-app x
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
18
Issue
18
列表
看板
标记
里程碑
合并请求
1
合并请求
1
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
提交
a6f84482
编写于
11月 11, 2024
作者:
M
mahaifeng
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[share]修改share目录结构
上级
ac8bcf4a
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
485 addition
and
485 deletion
+485
-485
pages.json
pages.json
+9
-9
pages/API/share/share.uvue
pages/API/share/share.uvue
+476
-476
未找到文件。
pages.json
浏览文件 @
a6f84482
...
...
@@ -1259,6 +1259,15 @@
}
},
//
#endif
//
#ifdef
APP
{
"path"
:
"pages/API/share/share"
,
"style"
:
{
"navigationBarTitleText"
:
"分享"
,
"enablePullDownRefresh"
:
false
}
},
//
#endif
{
"path"
:
"pages/tabBar/CSS"
,
"style"
:
{
...
...
@@ -1858,15 +1867,6 @@
}
},
//
#endif
//
#ifdef
APP-ANDROID
{
"path"
:
"pages/template/share/share"
,
"style"
:
{
"navigationBarTitleText"
:
"分享"
,
"enablePullDownRefresh"
:
false
}
},
//
#endif
//
#ifdef
APP
||
WEB
{
"path"
:
"uni_modules/uni-pay-x/pages/success/success"
,
...
...
pages/
template
/share/share.uvue
→
pages/
API
/share/share.uvue
浏览文件 @
a6f84482
<template>
<!-- #ifdef APP -->
<scroll-view direction="vertical" style="flex:1; margin-bottom: 50px;">
<!-- #endif -->
<view id="viewshot">
<button class="button" @click="shareText()">分享文本</button>
<button class="button" @click="shareLink()">分享链接</button>
<button class="button" @click="sharePrivateImg()">分享单个本地图片</button>
<button class="button" @click="sharePrivateImgs()">分享多个本地图片</button>
<button class="button" @click="shareAll()">分享链接、文本、一张图片</button>
<button class="button" @click="sharePrivateVideo()">分享video文件(单个)</button>
<button class="button" @click="sharePrivateVideos()">分享video文件(多个)</button>
<button class="button" @click="sharePrivateAudio()">分享Audio文件(单个)</button>
<button class="button" @click="sharePrivateAudios()">分享Audio文件(多个)</button>
<button class="button" @click="sharePrivateFile()">分享文件(单个)</button>
<button class="button" @click="sharePrivateFiles()">分享文件(多个)</button>
<button class="button" type="primary" @click="sharePrivateErrorImg()">分享单个本地图片(错误路径)</button>
<button class="button" type="primary" @click="sharePrivateErrorImgs()">分享多个本地图片(含有错误路径)</button>
<template>
<!-- #ifdef APP -->
<scroll-view direction="vertical" style="flex:1; margin-bottom: 50px;">
<!-- #endif -->
<view id="viewshot">
<button class="button" @click="shareText()">分享文本</button>
<button class="button" @click="shareLink()">分享链接</button>
<button class="button" @click="sharePrivateImg()">分享单个本地图片</button>
<button class="button" @click="sharePrivateImgs()">分享多个本地图片</button>
<button class="button" @click="shareAll()">分享链接、文本、一张图片</button>
<button class="button" @click="sharePrivateVideo()">分享video文件(单个)</button>
<button class="button" @click="sharePrivateVideos()">分享video文件(多个)</button>
<button class="button" @click="sharePrivateAudio()">分享Audio文件(单个)</button>
<button class="button" @click="sharePrivateAudios()">分享Audio文件(多个)</button>
<button class="button" @click="sharePrivateFile()">分享文件(单个)</button>
<button class="button" @click="sharePrivateFiles()">分享文件(多个)</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>
<button class="button" type="primary" @click="sharePrivateErrorAudios()">分享Audio文件(错误路径)</button>
<button class="button" type="primary" @click="sharePrivateErrorFiles()">分享文件(错误路径)</button>
<button class="button" type="warn" @click="sharePubImg()">选择图片并分享</button>
<button class="button" type="warn" @click="sharePubMedias()">选择video并分享</button>
<button class="button" type="warn" @click="shareSnapShot()">指定view截图并分享</button>
</view>
</scroll-view>
</template>
<script>
export default {
data() {
return {
summary: '欢迎使用hello uniapp-x'
}
},
<button class="button" type="primary" @click="sharePrivateErrorAudios()">分享Audio文件(错误路径)</button>
<button class="button" type="primary" @click="sharePrivateErrorFiles()">分享文件(错误路径)</button>
<button class="button" type="warn" @click="sharePubImg()">选择图片并分享</button>
<button class="button" type="warn" @click="sharePubMedias()">选择video并分享</button>
<button class="button" type="warn" @click="shareSnapShot()">指定view截图并分享</button>
</view>
</scroll-view>
</template>
<script>
export default {
data() {
return {
summary: '欢迎使用hello uniapp-x'
}
},
methods: {
sharePrivateErrorAudios() {
uni.hideToast()
...
...
@@ -59,462 +59,462 @@
}
})
},
sharePrivateErrorFiles() {
uni.hideToast()
const path1 : string = "/static/filemanager1/to.zip";
const path2 : string = "/static/filemanager/11.txt.br";
uni.shareWithSystem({
},
sharePrivateErrorFiles() {
uni.hideToast()
const path1 : string = "/static/filemanager1/to.zip";
const path2 : string = "/static/filemanager/11.txt.br";
uni.shareWithSystem({
filePaths: [path1, path2],
type:'file',
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) {
}
})
},
sharePrivateFile() {
uni.hideToast()
const path1 : string = "/static/filemanager/to.zip";
uni.shareWithSystem({
type:'file',
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) {
}
})
},
sharePrivateFile() {
uni.hideToast()
const path1 : string = "/static/filemanager/to.zip";
uni.shareWithSystem({
filePaths: [path1],
type:'file',
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) {
}
})
},
sharePrivateFiles() {
uni.hideToast()
const path1 : string = "/static/filemanager/to.zip";
const path2 : string = "/static/filemanager/1.txt.br";
uni.shareWithSystem({
type:'file',
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) {
}
})
},
sharePrivateFiles() {
uni.hideToast()
const path1 : string = "/static/filemanager/to.zip";
const path2 : string = "/static/filemanager/1.txt.br";
uni.shareWithSystem({
filePaths: [path1, path2],
type:'file',
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) {
}
})
},
sharePrivateAudio() {
uni.hideToast()
const path1 : string = "/static/test-audio/ForElise.mp3";
uni.shareWithSystem({
type:'file',
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) {
}
})
},
sharePrivateAudio() {
uni.hideToast()
const path1 : string = "/static/test-audio/ForElise.mp3";
uni.shareWithSystem({
audioPaths: [path1],
type:'audio',
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) {
}
})
},
sharePrivateAudios() {
uni.hideToast()
const path1 : string = "/static/test-audio/ForElise.mp3";
const path2 : string = "/static/test-audio/ForElise.mp3";
uni.shareWithSystem({
type:'audio',
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) {
}
})
},
sharePrivateAudios() {
uni.hideToast()
const path1 : string = "/static/test-audio/ForElise.mp3";
const path2 : string = "/static/test-audio/ForElise.mp3";
uni.shareWithSystem({
audioPaths: [path1, path2],
type:'audio',
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) {
}
})
},
sharePrivateErrorVideos() {
uni.hideToast()
const path1 : string = "/static/test-video/10second-demo.mp4";
const path2 : string = "/static/test-video/10second-demo1.mp4";
uni.shareWithSystem({
type:'audio',
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) {
}
})
},
sharePrivateErrorVideos() {
uni.hideToast()
const path1 : string = "/static/test-video/10second-demo.mp4";
const path2 : string = "/static/test-video/10second-demo1.mp4";
uni.shareWithSystem({
videoPaths: [path1, path2],
type:'video',
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) {
}
})
},
sharePrivateVideo() {
uni.hideToast()
const path1 : string = "/static/test-video/10second-demo.mp4";
uni.shareWithSystem({
type:'video',
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) {
}
})
},
sharePrivateVideo() {
uni.hideToast()
const path1 : string = "/static/test-video/10second-demo.mp4";
uni.shareWithSystem({
videoPaths: [path1],
type:'video',
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) {
}
})
},
sharePrivateVideos() {
uni.hideToast()
const path1 : string = "/static/test-video/10second-demo.mp4";
const path2 : string = "/static/test-video/10second-demo.mp4";
uni.shareWithSystem({
type:'video',
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) {
}
})
},
sharePrivateVideos() {
uni.hideToast()
const path1 : string = "/static/test-video/10second-demo.mp4";
const path2 : string = "/static/test-video/10second-demo.mp4";
uni.shareWithSystem({
videoPaths: [path1, path2],
type:'video',
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) {
}
})
},
sharePubMedias() {
uni.hideToast()
uni.chooseVideo({
success(res) {
uni.shareWithSystem({
type:'video',
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) {
}
})
},
sharePubMedias() {
uni.hideToast()
uni.chooseVideo({
success(res) {
uni.shareWithSystem({
videoPaths: [res.tempFilePath],
type:'video',
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) {
}
})
}
})
},
shareText() {
uni.hideToast()
uni.shareWithSystem({
type:'video',
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) {
}
})
}
})
},
shareText() {
uni.hideToast()
uni.shareWithSystem({
summary: this.summary,
type:'text',
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) {
}
})
},
shareLink() {
uni.hideToast()
type:'text',
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) {
}
})
},
shareLink() {
uni.hideToast()
uni.shareWithSystem({
type:'text',
href: 'https://uniapp.dcloud.io',
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({
type:'text',
href: 'https://uniapp.dcloud.io',
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";
type:'image',
imageUrl: imageSrc,
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) {
}
})
},
sharePrivateErrorImg() {
uni.hideToast()
const imageSrc : string = "/static/test-image/logo.jpg11";
uni.shareWithSystem({
type:'image',
imageUrl: imageSrc,
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) {
}
})
},
sharePrivateErrorImg() {
uni.hideToast()
const imageSrc : string = "/static/test-image/logo.jpg11";
uni.shareWithSystem({
imageUrl: imageSrc,
type:'image',
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) {
}
})
},
sharePrivateImgs() {
uni.hideToast()
const errorImageSrc1 : string = "/static/test-image/logo.gif";
const errorImageSrc2 : string = "/static/test-image/logo.png";
const imageSrc : string = "/static/test-image/logo.jpg";
let imageUrlList : string[] = Array()
imageUrlList.push(errorImageSrc2)
imageUrlList.push(imageSrc)
// imageUrlList.push(errorImageSrc1)
uni.shareWithSystem({
type:'image',
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) {
}
})
},
sharePrivateImgs() {
uni.hideToast()
const errorImageSrc1 : string = "/static/test-image/logo.gif";
const errorImageSrc2 : string = "/static/test-image/logo.png";
const imageSrc : string = "/static/test-image/logo.jpg";
let imageUrlList : string[] = Array()
imageUrlList.push(errorImageSrc2)
imageUrlList.push(imageSrc)
// imageUrlList.push(errorImageSrc1)
uni.shareWithSystem({
imagePaths: imageUrlList,
type:'image',
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) {
}
})
},
sharePrivateErrorImgs() {
uni.hideToast()
const errorImageSrc1 : string = "/static/test-image/logo.jpg1";
const errorImageSrc2 : string = "/static/test-image/logo.jpg3";
const imageSrc : string = "/static/test-image/logo.jpg";
let imageUrlList : string[] = Array()
imageUrlList.push(imageSrc)
imageUrlList.push(errorImageSrc1)
imageUrlList.push(errorImageSrc2)
uni.shareWithSystem({
type:'image',
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) {
}
})
},
sharePrivateErrorImgs() {
uni.hideToast()
const errorImageSrc1 : string = "/static/test-image/logo.jpg1";
const errorImageSrc2 : string = "/static/test-image/logo.jpg3";
const imageSrc : string = "/static/test-image/logo.jpg";
let imageUrlList : string[] = Array()
imageUrlList.push(imageSrc)
imageUrlList.push(errorImageSrc1)
imageUrlList.push(errorImageSrc2)
uni.shareWithSystem({
imagePaths: imageUrlList,
type:'image',
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) {
}
})
},
shareAll() {
uni.hideToast()
const imageSrc : string = "/static/test-video/fast-forward.png";
let imageUrlList : string[] = Array()
imageUrlList.push(imageSrc)
uni.shareWithSystem({
summary: this.summary,
href: 'https://uniapp.dcloud.io',
type:'image',
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) {
}
})
},
shareAll() {
uni.hideToast()
const imageSrc : string = "/static/test-video/fast-forward.png";
let imageUrlList : string[] = Array()
imageUrlList.push(imageSrc)
uni.shareWithSystem({
summary: this.summary,
href: 'https://uniapp.dcloud.io',
imagePaths: imageUrlList,
type:'image',
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) {
}
})
},
sharePubImg() {
uni.hideToast()
uni.chooseImage({
count: 3,
sourceType: ['camera', 'album'],
success(e) {
console.log(e)
console.log(JSON.stringify(e))
uni.shareWithSystem({
// summary: "aa",
// href: 'https://uniapp.dcloud.io',
type:'image',
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) {
}
})
},
sharePubImg() {
uni.hideToast()
uni.chooseImage({
count: 3,
sourceType: ['camera', 'album'],
success(e) {
console.log(e)
console.log(JSON.stringify(e))
uni.shareWithSystem({
// summary: "aa",
// href: 'https://uniapp.dcloud.io',
imagePaths: e.tempFilePaths,
type:'image',
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) {
}
})
}
})
},
shareSnapShot() {
uni.hideToast()
uni.getElementById("viewshot")?.takeSnapshot(
{
success: function (res) {
uni.shareWithSystem({
type:'image',
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) {
}
})
}
})
},
shareSnapShot() {
uni.hideToast()
uni.getElementById("viewshot")?.takeSnapshot(
{
success: function (res) {
uni.shareWithSystem({
imageUrl: res.tempFilePath,
type:'image',
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) {
}
})
},
fail: function (res) {
console.log(res)
uni.showToast({
icon: 'error',
title: '截图失败'
})
}
}
)
},
}
}
</script>
<style>
.button {
margin-left: 30px;
margin-right: 30px;
margin-bottom: 15px;
}
type:'image',
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) {
}
})
},
fail: function (res) {
console.log(res)
uni.showToast({
icon: 'error',
title: '截图失败'
})
}
}
)
},
}
}
</script>
<style>
.button {
margin-left: 30px;
margin-right: 30px;
margin-bottom: 15px;
}
</style>
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录