@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();
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)
beanSdk.render(container)