import{At as e,E as t,Ot as n,Xt as r}from"./chunks/framework.ECw2lWOt.js";var i=JSON.parse(`{"title":"DevtoolApi","description":"","frontmatter":{},"headers":[],"relativePath":"runtime-api/core/devtoolApi.md","filePath":"runtime-api/core/devtoolApi.md"}`),a={name:`runtime-api/core/devtoolApi.md`};function o(t,i,a,o,s,c){return r(),n(`div`,null,[...i[0]||=[e(`

DevtoolApi

DevtoolApi@tmagic/core 提供给开发工具使用的 API 接口类。

构造函数

typescript
new DevtoolApi(options: DevtoolApiOptions)

DevtoolApiOptions

参数类型说明
appApp应用实例

实例方法

openPop

typescript
devtoolApi.openPop('dialog_1');

setDataSourceData

typescript
// 设置整个数据源数据
devtoolApi.setDataSourceData('ds_1', { name: 'test' });

// 设置数据源的某个字段
devtoolApi.setDataSourceData('ds_1', 'newValue', 'user.name');

delDataSourceData

requestDataSource

typescript
await devtoolApi.requestDataSource('http_ds_1');

getDisplayCondRealValue

callHook

typescript
await devtoolApi.callHook('button_1', 'mounted', [
  { params: { data: 'test' } },
]);

trigger

typescript
devtoolApi.trigger('button_1', {
  name: 'click',
  actions: [{ actionType: 'code', codeId: 'code_1' }]
});

updateDsl

isValueIncludeDataSource

typescript
const hasDs = devtoolApi.isValueIncludeDataSource('\${ds_1.field}');
console.log(hasDs); // true

compileDataSourceValue

typescript
const compiled = devtoolApi.compileDataSourceValue('用户名:\${ds_1.user.name}');

updateCode

typescript
devtoolApi.updateCode('code_1', 'return data.value * 2;', 'content');
`,37)]])}var s=t(a,[[`render`,o]]);export{i as __pageData,s as default};