Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

大佬,这边有3个问题希望能够帮我看下 #84

Closed
Tracked by #45
liuk123456789 opened this issue Jul 19, 2021 · 4 comments
Closed
Tracked by #45

大佬,这边有3个问题希望能够帮我看下 #84

liuk123456789 opened this issue Jul 19, 2021 · 4 comments

Comments

@liuk123456789
Copy link

  1. Widget组件中 像keyup.enter、focus、blur等事件,我现在不知道应该怎么配置去处理这些事件
  2. v-model.trim这种带修饰符的目前我能够通过什么方式处理呢?
  3. 我想完成下图中的布局,文档中使用form-footer以及scope-slot好像都不能够满足我的需求
    image
@lljj-x
Copy link
Owner

lljj-x commented Jul 19, 2021

1、现在所有的ui:xxx 配置都是attrs透传给 widget组件的,Vue2 版本不能直接接受emits ,不过如果是vue3的版本 你可以直接通过配置 on 开头的props即可。

所以如果是Vue2 那你只能自己包装一下widget组件,通过props接受到on的值,然后 v-on在传递给子组件。

既然vue3支持,这里可以对vue2做个升级,添加一个类似 ui:on: { change() {} } 的配置来介绍emits,下个版本加上

2、 这个现在不支持直接配置,之前加过一个formatValue 可以允许配置后在格式化一次值,后面废弃了。

所以现在可以解决方案和1类似,在包装下需要处理的widget组件。

3、不行,最后的三个按钮在超过一行时会另起一行,因为在inline布局时,表单内容和footer是两个 inline block。

可以尝试css是否可实现,或者通过 ui:field 直接把按钮包裹 field组件内

@lljj-x lljj-x mentioned this issue Jul 19, 2021
15 tasks
@liuk123456789
Copy link
Author

好的,感谢大佬解疑
3中的css无法实现,想问下ui:field需要怎么配置呢?

@lljj-x
Copy link
Owner

lljj-x commented Jul 20, 2021

ui:field 可以直接配置一个组件来接管当前schema的渲染,然后通过 内部调用 SchemaField 组件在交给vueForm继续渲染,这样直接遍历你的 properties 属性,然后在尾部追加你的几个按钮。

参考文件:
https://github.com/lljj-x/schema-form-components/blob/main/packages/lib/src/fields/TabField/index.vue
预览:https://demo.buhuida.com/schema-form-components


不过这里你在自定义field组件内并不能获取到 form组件实例,并且似乎并不好直接获取表单实例,你可以先尝试下,可以调整表单外层直接provide 出表单根节点实例。

@liuk123456789
Copy link
Author

好的,我对比文档弄一下,非常感谢!希望后续版本功能越来越强大😄

@lljj-x lljj-x closed this as completed Jul 27, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants