uni-app写app点击app的分享,分享至微信,在微信中点击分享卡片打开小程序并跳转至相应页面

本文介绍了如何使用uni-app开发APP时,设置分享功能,使得用户在微信中点击分享卡片能直接打开对应的小程序页面,详细讲解了在小程序onload方法中捕获并处理分享参数以实现页面跳转。
摘要由CSDN通过智能技术生成
uni-app写的app
// 分享小程序
        async handleShare(index) {
            let _this = this;

            setTimeout(() => {
                this.drawCanvas();
                setTimeout(async () => {
                    this.canvasFlag = false;
                }, 4000);
            }, 100);
            this.canvasFlag = true;
        },
        drawCanvas() {
            let _this = this;
            this.$nextTick(async () => {
                //初始化
                await this.$refs.rCanvas
                    .init({
                        canvas_id: 'rCanvas',
                        canvas_width: 399,
                        canvas_height: 299,
                        background_color: '#fff',
                        position: 'fixed',
                        top: 50,
                        left: 50
                    })
                    .catch(err_msg => {
                        uni.showToast({
                            title: err_msg,
                            icon: 'none'
                        });
                    });
                console.log('_this.detail.info.factorycategory', _this.$config.imgBaseUrl);
                //画图片   暂时隐藏
                await this.$refs.rCanvas
                    .drawImage({
                        url: _this.$config.imgBaseUrl + 'share_bg.png',
                        x: -12,
                        y: 0,
                        w: 399,
                        h: 299
                    })
                    .catch(err_msg => {
                        uni.showToast({
                            title: err_msg,
                            icon: 'none'
                        });
                    });

                // 画文字
                //、文字的第一行
                await this.$refs.rCanvas
                    .drawSpecialText({
                        general: {
                            x: 80,
                            y: 35
                        },
                        list: [
                            {
                                text: _this.detail.info.title,
                                font_color: '#000',
                                font_size: 15,
                                text_align: 'center',
                                font_weight: 'bold'
                            }
                        ]
                    })
                    .catch(err_msg => {
                        uni.showToast({
                            title: err_msg,
                            icon: 'none'
                        });
                    });
                await this.$refs.rCanvas
                    .drawSpecialText({
                        general: {
                            x: 140,
                            y: 35
                        },
                        list: [
                            {
                                text: '|',
                                font_color: '#666',
                                font_size: 10,
                                text_align: 'center',
                                font_weight: 'bold'
                            }
                        ]
                    })
                    .cat
  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值