2.0.2 • Published 1 year ago

market-react v2.0.2

Weekly downloads
-
License
-
Repository
-
Last release
1 year ago

盯链流转市场H5

盯链开放平台

  • 安装依赖

    npm i market-react
  • 使用

    import { useRef, useCallback } from "react";
    import { DingBlockMarket } from "dingblock-market-react";
    
    const market = useRef();
    // 用户退出登录需调用cancelAuth取消授权
    const handleLogout = () => {
      market.current?.cancelAuth?.();
    };
    // 切换主题使用changeTheme
    const handleChangeTheme = (value) => {
      market.current?.changeTheme?.(value);
    };
    
    const auth = useCallback(async () => {
      return "DINGBLOCK_AUTH_TOKEN";
    }, []);
    
     const check = useCallback(async () => {
      return "USER_ID";
    }, []);
    
    // 可以重写跳转逻辑
    const handleRedirect = useCallback((link) => {
      window.location.href = link;
    }, []);
    
    return (
      <DingBlockMarket
        appId="YOUR_APPID"
        theme="dark"
        ref={market}
        auth={auth}
        check={check}
        onRedirect={handleRedirect}
      />
    );
2.0.2

1 year ago

2.0.1

2 years ago

2.0.0

2 years ago

1.0.2

2 years ago

1.0.1

2 years ago

1.0.0

2 years ago