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)
- 复制带分隔符的文本到inputTag,max属性和去重会失效
- 增删改查控件如果mode是cards,不支持rowClick事件吗,设置了点击卡片无效
- 数据域里增加静态数据时,如果key以__开头,不生效 HOT 8
- 请问crud组件是否完全支持table和table2的所有功能 HOT 1
- code组件值为空时控制台会出现报错 HOT 1
- crud组件切换外观-卡片或列表,行点击事件无效 HOT 1
- 在crud插件搜索内添加时间范围插件,清空时间只能清除startTime,endTime清除不了 HOT 1
- 表格的复制功能,可以不复制id吗,操作流程:后端返回表格数据后,然后点击复制。这样会导致这2行的id一样,提交给后端,后端处理数据的时候就会认为是同一条数据,导致数据覆盖 HOT 1
- TreeSelect 树形选择器,开启多选,onlyLeaf设置为true不生效 HOT 2
- form组件能否在重置按钮之后,清空缓存 HOT 1
- input-text选择器模式+多选模式在删除内容时触发不了change事件 HOT 1
- 表单项 validateApi 接口连续请求,之前的接口会被取消,校验提示信息展示有问题
- 条件组件,里面是一个且的条件下,有值,表单校验位空:bug HOT 2
- [amis-editor] 在vite项目中调用报错:[mobx-state-tree] You are trying to read or write to an object that is no longer part of a state tree.
- 怎么在button的事件中控制按钮本身loading的开关
- 如何在curd里显示combo组件提交的内容?
- 建议二维码 组件渲染的时候 将svg转成canvas 这样可以右键复制,否则无法复制图片 需要截图才可以在其他地方用 HOT 2
- 表单里面有个crud,阻止了表单回车提交,但是crud 回车查询也不管用了,希望crud查询生效,底层表单不生效,如何设置 HOT 1
- 【BUG】InputDatetime 日期时间 设置值格式 ISO8601,自动转换成UTC格式 HOT 1
- 角标支持表格、page等场景使用
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.