uniapp - 右上角分享

onLoad同级,有图片就用图片,没图片就直接用屏幕截图

    onShareAppMessage() {
        let that = this;
        let pages = getCurrentPages();
        let route = pages[pages.length - 1].$page.fullPath;
        let imageUrl = that.shareUrl || '';
        if (imageUrl != '') {
            return {
                title: 'XXX',
                path: route,
                imageUrl: imageUrl,
            };
        } else {
            return {
                title: 'XXX',
                path: route,
            };
        }
    },
posted @ 2021-05-17 14:27  gggggggxin  阅读(522)  评论(0编辑  收藏  举报