Comments (7)
调用amis渲染器入口函数,
render(schema, props, env)
注意第二个参数是下发到渲染的 props 里面的,如果你在这个时候下发数据,这里面的数据就是全局的了
render(schema, {
data: {
appInfo: xxx,
userInfo: xxx,
acl: xxx // 你还可以注入功能方法,这样 visibleOn 里面都能些 acl.can('doXXX')
}
})
from amis.
return render(schema, {
location,
theme,
aaa: 555, <====== ( 1 )
bbb: 'test', <====== ( 2 )
type: 'axx', <====== ( 3 )
data: {eee:3}, <====== ( 4 )
ui: {
isVisibleFun: () => true, <=========== ( 5 )
isVisible: true <=========== ( 6 )
}
}, this.env);
在schema
中:
- 使用
tpl
打印 aaa , bbb , eee , 无法获取到aaa, bbb:
{
type: 'page',
body: {
type: 'tpl',
tpl: '${&|json|html}' =======> { eee: 3}
},
}
aaa, bbb 因为不在data中, 如何取出?
- 使用form.formItem:
{
type: form,
controls: [
...
disabledOn: "ui.isVisibleOn()" , <== 无效
disabledOn: "ui.isVisible", <== 无效
disabledOn: "() => ui.isVisibleOn()" <== 无效
]
}
求指教...
from amis.
都要放在 data 里面才能取出
from amis.
这样的话, 感觉有两个潜在问题:
1 ) 各级data在合并时, 容易存在重名覆盖问题
2 ) 顶级data既有数据也有方法, 方法也将逐渐向下合并
请教一下:
为何没有考虑 data 在合并时, 带上自己的name减少冲突机会呢?
{
[ top_component_name ] : { x: 1, y: 2},
[ parent1_component_name ] : {x: 2, z: 3},
[ self_component_name ] : { x: 3, z: 4}
}
可能实际情况没这么多冲突机会, 纯好奇 :)
from amis.
不会向下合并,每一层的 原型链指向上一层的数据
from amis.
原型链是技术实现手段, 但在 最终使用amis 的程序员看来, 这与合并没啥两样...
不过确实稍微注意一下, 普通的mis系统也不会有什么命名冲突吧
感谢您的耐心回复 👍
from amis.
如果出现重名可以尝试 ${__super.xxxx}
from amis.
Related Issues (20)
- 页面变量与 内存变量在 amis-edit 编辑器中不能选择,不能使用 HOT 1
- Picker组件弹出列表为嵌套懒加载模式时,弹出列表后展开节点时没有自动勾选上字段值中包含的选项
- GETRENDERERDATA获取数据失败 HOT 1
- 如何实现每增加一个时间区间,开始时间是上一条的结束时间 HOT 1
- inputable父子结构数据下,可编辑存在bug(同时开启编辑多行) HOT 2
- Table2 自定义列部分情况下无法点击
- 希望dropdown-button组件的label属性支持page HOT 1
- 能不能出一个amis-ui的文档,现在amis文档组件都是基于渲染器的文档
- crud 的 autoJumpToTopOnPagerChange 属性 和 autoFillHeight 属性一起使用设置为true 时, autoJumpToTopOnPagerChange 属性功能不生效,这个能否支持下?
- amis-ui/lib/components/Editor定义全局window.MonacoEnvironment导致非amis的monaco editor无法正常使用
- autoFill功能异常,在表单初始化时不应该执行 HOT 1
- 菜单栏展开后子菜单出现从左到右的滑动效果,如何关闭
- Inputtable children后,填入数据总是自动收起。是不支持,树录入数据吗? HOT 1
- 3.6.3中的crud组件使用时,switch开关操作请求接口,点击分页后,id发生错位
- 建议mapping多个参数映射时候增加类似select得maxTagCount属性
- [email protected]在react@18+的concurrent模式下,出现报错问题 HOT 1
- mobx版本太低
- amis-editor-demo 启动报错 Module not found: Error: Can't resolve 'ts-loader'
- input-table组件节点嵌套的children属性所属父节点上没有显示折叠按钮,折叠按钮显示在根节点了
- websocket优化
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from amis.