Skip to content
This repository has been archived by the owner on Mar 7, 2024. It is now read-only.

[BUG]在页面中定义了onShareAppMessage 不生效 #1413

Closed
w-xuefeng opened this issue Dec 4, 2020 · 4 comments
Closed

[BUG]在页面中定义了onShareAppMessage 不生效 #1413

w-xuefeng opened this issue Dec 4, 2020 · 4 comments
Labels
bug Something isn't working

Comments

@w-xuefeng
Copy link
Contributor

bug 描述
在页面中定义了onShareAppMessage 方法,但是页面还是没有分享转发功能

复现步骤

  • 创建项目 npx create-remax-app my-app
  • 安装依赖 remax 版本为 2.9.5
  • 修改 pages/index/index.js 为如下代码
import * as React from 'react';
import { View, Image } from 'remax/one';
import styles from './index.css';

class Index extends React.Component {

  onShareAppMessage() {
    return {
      title: '测试标题',
      path: `/pages/index/index?entry=appMessage`
    }
  }

  onShareTimeline() {
    return {
      title: '测试标题',
      query: `entry=timeline`
    }
  }

  render() {
    return (
      <View className={styles.app}>
        <View className={styles.header}>
          <Image
            src="https://gw.alipayobjects.com/mdn/rms_b5fcc5/afts/img/A*OGyZSI087zkAAAAAAAAAAABkARQnAQ"
            className={styles.logo}
            alt="logo"
          />
          <View className={styles.text}>
          onShareAppMessage 测试
        </View>
        </View>
      </View>
    );
  }
}

export default Index

期望结果
在 remax 最新版中 页面内定义 onShareAppMessage 方法后,能够具有页面分享转发功能

复现代码
见复现步骤

版本信息:

  • remax 版本: [2.9.5]
  • 手机型号: [all]
  • 小程序端: [微信小程序]
  • 小程序版本: [2.3.0]
  • 开发环境: [mac OS]

其他信息
回滚 remax 版本到 2.8.7 就有分享转发功能了

@w-xuefeng w-xuefeng added the bug Something isn't working label Dec 4, 2020
@whereiscode
Copy link

在页面里使用 usePageEvent('onShareAppMessage', ()=>{
title:'xxxx',
....
})
无效,这个usePageEvent onShareAppMessage到底应该怎么用呢?

@yesmeck
Copy link
Member

yesmeck commented Dec 6, 2020

@whereiscode 正在看这个问题

@whereiscode
Copy link

@yesmeck 十分感谢你

@yesmeck yesmeck closed this as completed in 6376d04 Dec 6, 2020
@w-xuefeng
Copy link
Contributor Author

在微信小程序开发者工具和安卓手机下,onShareTimeline 也不生效,从2.9.5 到 2.11.2 都不生效,2.8.7 正常

  • 2.11.2 如下图

  • 2.8.7 如下图

复现步骤

创建项目 npx create-remax-app my-app
安装依赖 remax 版本为 2.11.2
修改 pages/index/index.js 为如下代码

import * as React from 'react';
import { View, Image } from 'remax/one';
import styles from './index.css';

class Index extends React.Component {

  onShareAppMessage() {
    return {
      title: '测试标题',
      path: `/pages/index/index?entry=appMessage`
    }
  }

  onShareTimeline() {
    return {
      title: '测试标题',
      query: `entry=timeline`
    }
  }

  render() {
    return (
      <View className={styles.app}>
        <View className={styles.header}>
          <Image
            src="https://gw.alipayobjects.com/mdn/rms_b5fcc5/afts/img/A*OGyZSI087zkAAAAAAAAAAABkARQnAQ"
            className={styles.logo}
            alt="logo"
          />
          <View className={styles.text}>
          onShareAppMessage 测试
        </View>
        </View>
      </View>
    );
  }
}

export default Index

期望结果
在 remax 最新版中 页面内定义 onShareTimeline 方法后,能够具有页面分享到朋友圈的功能

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants