更新记录
1.0.0(2025-09-22)
初始化
平台兼容性
uni-app(3.6.5)
Vue2 |
Vue3 |
Chrome |
Safari |
app-vue |
app-nvue |
Android |
iOS |
鸿蒙 |
√ |
√ |
- |
- |
√ |
√ |
5.0 |
- |
- |
微信小程序 |
支付宝小程序 |
抖音小程序 |
百度小程序 |
快手小程序 |
京东小程序 |
鸿蒙元服务 |
QQ小程序 |
飞书小程序 |
快应用-华为 |
快应用-联盟 |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
uni-app x(3.6.5)
Chrome |
Safari |
Android |
iOS |
鸿蒙 |
微信小程序 |
- |
- |
5.0 |
- |
- |
- |
其他
xtf-share
uniappx
<template>
<view>
<button style="margin: 10rpx;" type="primary" @click="onClick(0)">分享文本</button>
<button style="margin: 10rpx;" type="primary" @click="onClick(1)">分享图片</button>
<button style="margin: 10rpx;" type="primary" @click="onClick(2)">分享视频</button>
<button style="margin: 10rpx;" type="primary" @click="onClick(3)">分享文件</button>
<image :src="p"></image>
</view>
</template>
<script>
import { shareText,shareImage, shareVideo, shareFile } from '@/uni_modules/xtf-share';
export default {
data() {
return {
title: 'Hello',
p:"",
}
},
onLoad() {
},
methods: {
onClick(id:number){
var that=this;
if(id==0){
shareText("title","xtf")
}else if(id==1){
uni.chooseImage({
count: 2,
success: (res) => {
console.log("this.imageList: ",res)
shareImage("xxx",res.tempFilePaths);
},
fail: (err) => {
console.log("err: ", JSON.stringify(err));
}
})
}else if (id==2){
uni.chooseVideo({
success: (res) => {
console.log("this.imageList: ",res)
shareVideo("xxx",[res.tempFilePath] as string[] );
},
fail: (err) => {
console.log("err: ", JSON.stringify(err));
}
})
}else if(id==3){
uni.chooseFile({
count:1,
success:(res)=> {
shareFile("xtf",res.tempFilePaths);
}
})
}
}
}
}
</script>
<style>
.logo {
height: 100px;
width: 100px;
margin: 100px auto 25px auto;
}
.title {
font-size: 18px;
color: #8f8f94;
text-align: center;
}
</style>
uniapp
<template>
<view>
<button style="margin: 10rpx;" type="primary" @click="onClick(0)">分享文本</button>
<button style="margin: 10rpx;" type="primary" @click="onClick(1)">分享图片</button>
<button style="margin: 10rpx;" type="primary" @click="onClick(2)">分享视频</button>
<button style="margin: 10rpx;" type="primary" @click="onClick(3)">分享文件</button>
<image :src="p"></image>
</view>
</template>
<script>
import { shareText,shareImage, shareVideo, shareFile } from '@/uni_modules/xtf-share';
export default {
data() {
return {
title: 'Hello',
p:"",
}
},
onLoad() {
},
methods: {
onClick(id){
var that=this;
if(id==0){
shareText("title","xtf")
}else if(id==1){
uni.chooseImage({
count: 2,
success: (res) => {
console.log("this.imageList: ",res)
shareImage("xxx",res.tempFilePaths);
},
fail: (err) => {
console.log("err: ", JSON.stringify(err));
}
})
}else if (id==2){
uni.chooseVideo({
success: (res) => {
console.log("this.imageList: ",res)
shareVideo("xxx",[res.tempFilePath] as string[] );
},
fail: (err) => {
console.log("err: ", JSON.stringify(err));
}
})
}else if(id==3){
uni.chooseFile({
count:1,
success:(res)=> {
shareFile("xtf",res.tempFilePaths);
}
})
}
}
}
}
</script>
<style>
.logo {
height: 100px;
width: 100px;
margin: 100px auto 25px auto;
}
.title {
font-size: 18px;
color: #8f8f94;
text-align: center;
}
</style>
开发文档
UTS 语法
UTS API插件
UTS uni-app兼容模式组件
UTS 标准模式组件
Hello UTS