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

fix: form prop rules不生效 #208

Merged
merged 2 commits into from
Dec 31, 2020
Merged

Conversation

yolofit
Copy link
Contributor

@yolofit yolofit commented Dec 17, 2020

Why

form rules不生效

element-ui form-items获取 rules源码
image

How

online demo
Describe your steps:

  1. one step
  2. two step...

You may use xmind or other mind map to show you logic

Test

Show your test case

you'd better show before and after

Docs

It there requires a change to the documentation?

@auto-add-label auto-add-label bot added the bug Something isn't working label Dec 17, 2020
@levy9527
Copy link
Contributor

场景?测试?

@yolofit
Copy link
Contributor Author

yolofit commented Dec 29, 2020

场景?测试?

场景:

表单rules支持独立抽出来写,不冗余到content的每一个item。
而form-renderer只支持把rules写到每一个context内,this.content=[{id,type,rules}], 不生效的online demo

像element-ui本身就支持把rules放到form内或者el-input内的。
两者是存在覆盖关系的,优先级可见开头的源码片段 input rules > form rules

<el-form rules="[{...}]" />
<el-input rules="[{...}]">

测试?

这个唔知咋提供测试
在本地测试是可符合预期的,其行为和element-ui一致

@levy9527
Copy link
Contributor

@yolofit 你好,你可以把本地测试的截图给一下吗。就是看下修改前是怎样的,修改后是怎样的,两张截图即可。

可参考:FEMessage/v-img#38

@yolofit
Copy link
Contributor Author

yolofit commented Dec 31, 2020

@yolofit 你好,你可以把本地测试的截图给一下吗。就是看下修改前是怎样的,修改后是怎样的,两张截图即可。

可参考:FEMessage/v-img#38

我额外提交了一个rules-plus.md,里面可以跑demo

未修改的rules, rules不生效
image

修改后的rules,rules生效
image

@levy9527
Copy link
Contributor

@all-contributors add @yolofit bug

@allcontributors
Copy link
Contributor

@levy9527

I've put up a pull request to add @yolofit! 🎉

@levy9527 levy9527 merged commit 4d518ce into FEMessage:master Dec 31, 2020
@levy9527
Copy link
Contributor

levy9527 commented Dec 31, 2020

合并了,不过,兄弟下次你要注意对 dev 发起合并。。。master 一合并就会发版本的。

levy9527 pushed a commit that referenced this pull request Dec 31, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants