h***@163.com
h***@163.com
  • 发布:2021-03-29 08:51
  • 更新:2021-11-09 11:37
  • 阅读:2646

onShareTimeline具体的参数及写法是什么?

分类:uni-app

我瞅了下官网 没做说明啊,有大神知道的吗,非常感谢。

2021-03-29 08:51 负责人:无 分享
已邀请:
7***@qq.com

7***@qq.com - life is a fucking movie

onShareTimeline() {
return {
title: '自定义标题',
query: {//页面携带参数
key: value
},
imageUrl: '自定义图片路径'
};
}

  • h***@163.com (作者)

    谢谢回答 但是貌似还是不行呢

    onShareTimeline() {

    return {

    title: "" + this.myFormData.userId + "学编程【" + this.typeName + "】报告已生成,快来看看吧~",

    // path: '/pages/growth/growthPreview?id='+this.myFormData.id,

    // query:'/pages/growth/growthPreview?id='+this.myFormData.id,

    query: {//页面携带参数

    id: this.myFormData.id

    },

    imageUrl: this.imgUrl,

    content: '学编程,就来【高新编程猫】,赢在未来',

    desc: "" + this.myFormData.userId + "学编程又有新作品啦,快来看看吧~",

    success: res => {

    console.info('分享成功了',res)

    }

    }

    }

    2021-03-29 10:07

h***@163.com

h***@163.com (作者)

onLoad(options) {
console.log('options',options)
if(options.id){
console.log(options)
this.id=options.id;
}else{
let query=this.$Route.query
console.log(query)
this.id=query;
}

        this.getDetail()  

    }  

初始化时获取不到id信息
options undefined
growthPreview.js? [sm]:25 params undefined
VM207 WAService.js:2 TypeError: Cannot read property 'id' of undefined
at i.onLoad (growthPreview.js? [sm]:25)
at i.u (vendor.js? [sm]:197)
at vendor.js? [sm]:193
at w (vendor.js? [sm]:43)
at Generator._invoke (vendor.js? [sm]:43)
at Generator.e.<computed> [as next] (vendor.js? [sm]:43)
at l (vendor.js? [sm]:193)
at i (vendor.js? [sm]:193)

7***@qq.com

7***@qq.com - life is a fucking movie

query修改这个试试

query: id=${this.myFormData.id}

  • h***@163.com (作者)

    还是不可以 我用的是微信开发工具的编译环境 小程序没发不成体验版

    2021-03-29 15:29

  • 种子的信仰

    我试了 query: 'id=xxx', 这个是可行的, 感谢

    2021-06-18 12:10

h***@163.com

h***@163.com (作者)

有大神知道吗 帮解决 有好处~~

小书1998

小书1998

请问解决了嘛?怎么解决的啊

张亚博

张亚博

作者解决了吗,我也遇到这个问题了

该问题目前已经被锁定, 无法添加新回复