左树右表的其他实现
lostinyouu opened this issue · comments
Lostinyou commented
owl admin示例中左树右表需要当前页面刷新
// 按照 amis 示例, 这里应该是设置完 submitOnChange 和 target:window 之后就可以了
// 但是不生效, 曲线救国使用 onEvent 结合路径跳转实现
amis()
->TreeControl('tree')
->submitOnChange()
->options($this->service->tree())
->showIcon(false)
->onEvent([
// 当选中项发生变化时, 触发事件
'change' => [
'actions' => [
// 跳转到指定路径, 并且将选中项的值作为参数传递
[
'actionType' => 'url',
'args' => [
'url' => '/dev_example/left_tree_right_table?tree=${tree}',
],
],
],
],
])
),
其他做法,使用 change刷新另外一个表格组件,无需跳转 刷新组件请求
amis()->TreeControl('category_code')->className('maxWidthProcure')->initiallyOpen()->options($tree)->showIcon(false)
->onEvent([
'change' => [
'actions' => [
[
'actionType' => 'reload',
'componentId' => 'reload_service',
'data' => [
'categories_code' => '${category_code}'
]
]
],
],
])
slowlyo commented
有兴趣可以给demo提个pr 🤭