taro-ui icon indicating copy to clipboard operation
taro-ui copied to clipboard

AtButton 支付宝个人信息授权无法调用

Open Link-X opened this issue 2 years ago • 2 comments

问题描述 UI组件 AtButton 支付宝环境设置了 openType="getAuthorize" 和 onGetAuthorize={xxx} 时,不触发获取授权事件,taro/components的button可以。

复现步骤

// js
import Taro, { login, checkSession } from "@tarojs/taro";
import { useCallback, useState } from "react";

const getUserInfo = (props?: any) => {
  const alipayLogin = useCallback(async () => {
    try {
      const code = await Taro.getOpenUserInfo();
      console.log(code);
    } catch (err) {
      console.log(err);
    }
  }, []);

  const [options] = useState({
    openType:  "getAuthorize" ,
    onGetAuthorize: alipayLogin,
    scope: "userInfo",
  });

  return { options };
};


// tsx
 const {options} = getUserInfo()
  <AtButton {...options}>获取个人信息</Button>

期望行为 期望正常调起支付宝小程序的获取个人信息

报错信息 没反应

系统信息 Taro v3.4.10 Taro CLI 3.4.10 environment info: System: OS: macOS 12.4 Shell: 5.8.1 - /bin/zsh Binaries: Node: 16.15.0 - /usr/local/bin/node Yarn: 1.22.18 - /usr/local/bin/yarn npm: 8.5.5 - /usr/local/bin/npm npmPackages: @tarojs/cli: 3.4.10 => 3.4.10 @tarojs/components: 3.4.10 => 3.4.10 @tarojs/mini-runner: 3.4.10 => 3.4.10 @tarojs/plugin-framework-react: 3.4.10 => 3.4.10 @tarojs/react: 3.4.10 => 3.4.10 @tarojs/runtime: 3.4.10 => 3.4.10 @tarojs/taro: 3.4.10 => 3.4.10 @tarojs/webpack-runner: 3.4.10 => 3.4.10 babel-preset-taro: 3.4.10 => 3.4.10 eslint-config-taro: 3.4.10 => 3.4.10 react: ^17.0.2 => 17.0.2 taro-ui: 3.1.0-beta.2 => 3.1.0-beta.2

补充信息 AtButton. 属性设置不正确。

Link-X avatar May 30 '22 10:05 Link-X

欢迎提交 Issue~

如果你提交的是 bug 报告,请务必遵循 Issue 模板的规范,尽量用简洁的语言描述你的问题,最好能提供一个稳定简单的复现。🙏🙏🙏

如果你的信息提供过于模糊或不足,或者已经其他 issue 已经存在相关内容,你的 issue 有可能会被关闭。

Good luck and happy coding~

taro-ui-bot[bot] avatar May 30 '22 10:05 taro-ui-bot[bot]

看样子是 参数问题,能否提个 pr 修复

shinken008 avatar Aug 06 '22 08:08 shinken008