You need to enable JavaScript to run this app.
文档中心
智能数据洞察(私有化)

智能数据洞察(私有化)

复制全文
下载 pdf
进阶指南
组件API
复制全文
下载 pdf
组件API

DataWind 在组件上提供了部分 API。使用 SDK 时,你可以调用 Web Component 上的组件 API 以实现部分业务功能。

1. API 参数

调用方法的接口描述如下:

abstract class Component {
  abstract async invoke(functionName: string, data?: any): Promise<any>
}

对应的方法名、参数和返回值如下:

ComponentFunctionNameDataReturnTypeDescription
dashboardcreateSnapshotvoidPromise获取当前仪表盘书签(快照)id,当 aeolus-dashboard 传入 snapshotId 时会还原 snapshotId 对应的仪表盘控件参数,如筛选值、动态字段值等
dashboardrefreshDashboardvoidPromise刷新仪表盘,v2.46生效
dashboardshowExportModalvoidPromise显示仪表盘导出弹窗,v2.46生效
2. 代码示例

一个获取仪表盘书签(快照)id的示例如下

import React from 'react'
import ReactDOM from 'react-dom'


class BIComponent extends React.Component {
  componentDidMount() {
    /**
     * Using `document.querySelector(YOUR_SELECTOR)` or `ref.current` to access the aeolus component dom element
     * @example ref.current.invoke(FUNC, DATA)
     */
    document
      .querySelector('bi-dashboard')
      .invoke('createSnapshot')
      .then(({ snapshotId }) => {
        // do something with `snapshotId`
      })
  }

  render() {
    return (
      <bi-dashboard
        urlPrefix='https://console.volcengine.com/bi/datawind'
        dashboardId='******'
        appId='******'
      />

    )
  }
}

ReactDOM.render(<BIComponent />, document.querySelector('body'))


最近更新时间:2023.05.26 20:15:02
这个页面对您有帮助吗?
有用
有用
无用
无用