This commit is contained in:
2025-09-14 00:21:54 +08:00
commit d40b3bbd62
766 changed files with 36275 additions and 0 deletions

View File

@@ -0,0 +1,39 @@
.img {
width: 100%;
height: 100%;
}
.view12 {
display: none;
font-size: larger;
background-color: aqua;
}
.container {
font-size: 32rpx;
}
.title {
font-weight: bold;
font-size: 26rpx;
color: #333;
margin-top: 20rpx;
}
.share-desc {
font-size: 28rpx;
color: var(--xhs-theme-color);
font-weight: bold;
font-style: italic;
margin-top: 20rpx;
}
.share-resp {
border: 1px solid rgab(0, 0, 0, 0.1);
background: #f2f2f2;
font-style: italic;
font-size: 24rpx;
padding: 10px;
color: rgba(0, 0, 0, 0.55);
min-height: 200rpx;
}

View File

@@ -0,0 +1,73 @@
Page({
data: {
onShareAppMessageResult: null,
onShareChatResult: null,
onShareTimelineResult: null,
},
// 内心
onShareAppMessage(args) {
console.log(' ==== onShareAppMessage 站内分享 log ===', args);
this.setData({
onShareAppMessageResult: args
});
let self = this;
return {
title: '这是测试转发标题',
path: '/component-case/share-sample/share-sample?id=123',
content: 'onShareAppMessage 默认 content',
success() {
self.setData({
});
xhs.showToast({
title: 'onShareAppMessage 开发者回调,分享成功!',
});
},
fail() {
xhs.showToast({
title: 'onShareAppMessage 开发者回调,分享失败!',
});
}
};
},
onShareChat(args) {
console.log('==== onShareTimeline 微信(私信) log ===', args); // { from: 'menu'}
this.setData({
onShareChatResult: args
});
return {
title: 'onShareChat测试',
path: '/component-case/share-sample/share-sample',
success() {
xhs.showToast({
title: 'onShareChat 开发者回调,分享成功!',
});
},
fail() {
xhs.showToast({
title: 'onShareChat 开发者回调,分享失败!!',
});
}
};
},
onShareTimeline(args) {
console.log('==== onShareTimeline 微信(朋友圈) log ===', args);
this.setData({
onShareTimelineResult: args
});
return {
title: 'onShareTimeline测试',
success() {
xhs.showToast({
title: 'onShareTimeline 开发者回调,分享成功!',
});
},
fail() {
xhs.showToast({
title: 'onShareTimeline 开发者回调,分享失败!!',
});
},
};
}
});

View File

@@ -0,0 +1,7 @@
{
"navigationBarTitleText": "基础分享按钮演示",
"usingComponents": {
"showbox": "../../common/component/showbox/index",
"box": "../../common/component/container/index"
}
}

View File

@@ -0,0 +1,42 @@
<view class="container">
<showbox title="当前页面配置了【onShareAppMessage】【onShareChat】【onShareTimeline】">
<box class="box">
<view class="title">点击 button 按钮观察「onShareAppMessage」消息回调内容</view>
<button open-type="share" data-share-type="normal">share-type="normal"</button>
<view>
<view class="share-desc">
[onShareAppMessage] 消息回调内容:
</view>
<view class="share-resp _mt8">
{{ onShareAppMessageResult ? JSON.stringify(onShareAppMessageResult, null, 2) : '暂无返回' }}
</view>
</view>
</box>
<box class="box">
<view>
<view class="title">点击 button 按钮,点击「微信-私信分享」观察「onShareChat」消息回调内容</view>
<button open-type="share" data-share-type="shareChat">share-type="shareChat"</button>
<view class="share-desc">
[onShareChat] 消息回调内容:
</view>
<view class="share-resp _mt8">
{{ onShareChatResult ? JSON.stringify(onShareChatResult, null, 2) : '暂无返回' }}
</view>
</view>
</box>
<box class="box">
<view>
<view class="title">点击 button 按钮,点击「微信-朋友圈分享」观察「onShareTimeline」消息回调内容</view>
<button open-type="share" data-share-type="shareTimeline">share-type="shareTimeline"</button>
<view class="share-desc">
[onShareTimeline] 消息回调内容:
</view>
<view class="share-resp _mt8">
{{ onShareTimelineResult ? JSON.stringify(onShareTimelineResult, null, 2) : '暂无返回' }}
</view>
</view>
</box>
</showbox>
</view>