@ant-credit/bean-sdk
TypeScript icon, indicating that this package has built-in type declarations

1.3.0-rc.0 • Public • Published

@ant-credit/bean-sdk

bean 组件 sdk

安装依赖

npm i @ant-credit/bean-sdk --save

代码中使用

添加组件挂在节点

<body>
  <div id="BusinessInfo_PC"></div>
</body>

初始化 bean-sdk 并调用组件

import beanSdk from '@ant-credit/bean-sdk';
import { getMockComponentToken } from './your-own-utils';

async function main() {
  const componentToken = await getMockComponentToken(); // replace with your own get componenttoken function

  if (!componentToken) {
    return;
  }

  await beanSdk.init({
    componentToken,
  });

  const BusinessInfo_PC_Component = await beanSdk.create({
    name: 'BusinessInfo_PC',
    props: {
      crn: '911000001000013428',
      useInnerDataSource: true,
    },
    style: `
      body {
        width: 900px !important;
      }
    `,
  });
  BusinessInfo_PC_Component.render('#BusinessInfo_PC');
}

main();

SDK API

beanSdk 实例

beanSdk.init(param)

  • param
    • componentToken
    • debug
    • globalEnv
    • onComponentTokenExpired

beanSdk.create(param)

  • param
    • name
    • props
    • style
    • globalEnv

beanSdk.render(container)

  • container

/@ant-credit/bean-sdk/

    Package Sidebar

    Install

    npm i @ant-credit/bean-sdk

    Weekly Downloads

    2

    Version

    1.3.0-rc.0

    License

    MIT

    Unpacked Size

    468 kB

    Total Files

    5

    Last publish

    Collaborators

    • openwayne
    • eval-npm