初始化项目模板
This commit is contained in:
1 parent
80fd6a1d4b
commit
b3a69a1f27
69 files changed
+11088
No files matched your search
@@ -0,0 +1,29 @@
|
||||
import { onLoad, onShareAppMessage, onShareTimeline } from '@dcloudio/uni-app';
|
||||
|
||||
export function useSharePage(getParams) {
|
||||
const info = uni.getSystemInfoSync();
|
||||
// 页面中仍需要导入onShareAppMessage
|
||||
onShareAppMessage((e) => {
|
||||
if (info.uniPlatform !== 'web' && info.uniPlatform !== 'app') {
|
||||
uni.showShareMenu({
|
||||
withShareTicket: true,
|
||||
menu: ['shareAppMessage', 'shareTimeline'],
|
||||
});
|
||||
}
|
||||
const params = getParams || {}; // 每次分享时获取最新的参数
|
||||
const buttonParams = e.target?.dataset || {};
|
||||
return {
|
||||
title: '',
|
||||
...params,
|
||||
...buttonParams,
|
||||
};
|
||||
});
|
||||
// 页面中仍需要导入onShareTimeline
|
||||
onShareTimeline(() => {
|
||||
const params = getParams || {}; // 每次分享时获取最新的参数
|
||||
return {
|
||||
title: '',
|
||||
...params,
|
||||
};
|
||||
});
|
||||
}
|
||||
Reference in new issue
Block a user