t-comm
Version:
专业、稳定、纯粹的工具库
33 lines (31 loc) • 806 B
JavaScript
function getCurrentPage() {
var pages = getCurrentPages();
return pages[pages.length - 1];
}
function initShareMp(shareInfo) {
var page = getCurrentPage();
if (!page) return;
page.onShareAppMessage = function () {
return {
title: "".concat(shareInfo.title) || '',
path: shareInfo.mpPath || shareInfo.path || '',
imageUrl: shareInfo.mpImageUrl || shareInfo.imageUrl || shareInfo.icon || ''
};
};
}
function openShareUIMp(text, duration) {
if (text === void 0) {
text = '点击右上角"..."分享';
}
if (duration === void 0) {
duration = 3000;
}
uni.showToast({
title: text,
icon: 'none',
duration: duration,
success: function success() {},
fail: function fail() {}
});
}
export { getCurrentPage, initShareMp, openShareUIMp };