企业🤖AI Agent构建引擎,智能编排和调试,一键部署,支持私有化部署方案 广告
### 表达式 *view(data.js)的所有属性值支持表达式语法* *表达式可以支持js语法,见下面示例* * 绑定state中path为data.content的数据 ~~~js { ... value: `{{data.content}}` //value = state.data.content ... } ~~~ * 绑定action中方法名为onChange的函数 ~~~js { ... onChange:`{{$onChange}}` // onChange = action.$onChange ... } ~~~ * 函数体 ~~~js { onChange: `{{{ debugger; return $onChange }}}` /* onChange = new Function(` debugger; return action.onChange `)() */ } ~~~ ## data.js中ttk预置了哪些系统属性?(***) ``` { component: 'div', children: 'hello', _visible: 'true' } ``` 这里说的系统属性就是上面例子中的component、children、\_visible等; 除系统属性外还可以设置控件支持的任何属性; 主要支持下面描述的几种系统属性; * component 组件名,缺省可使用所有html元素 ~~~js { component: 'div' } //<div></div> ~~~ * children 子组件 ~~~js { component: 'div' children: { component: 'div', children: 'children' } } /* <div> <div>chidlren</div> </div> */ ~~~ * \_visible 是否显示,值支持表达式, 默认true ~~~js { component: 'div', _visible: false } ~~~ * \_power 循环,支持嵌套,用于数据的遍历 ~~~ const state = { data: { list: [{a:1}, {a:2}, {a:3}] } } const view = { component: 'div', children: { _power: 'for in data.list', // or (item,index) in data.list component: 'div', children: '{{data.list[_rowIndex].a}}' } } ~~~ *\_visible设置为false,将不创建该组件*