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

[新功能需求] form校验是否可以支持key为"xxx.xxx"形式 #257

Open
bsuooo opened this issue Apr 24, 2024 · 8 comments
Open

[新功能需求] form校验是否可以支持key为"xxx.xxx"形式 #257

bsuooo opened this issue Apr 24, 2024 · 8 comments
Labels
feature: need confirm 待确认的新特性

Comments

@bsuooo
Copy link

bsuooo commented Apr 24, 2024

这个功能解决了什么问题?

目前遇到了表单的key就是"abc.abc" 绑定时也绑定为 form"abc.abc"
是否可以添加一个api为"是否以.分割表单层级", prop也可以加支持string[]来表示层级
如果可以的话 我可以pr :)

你期望的 API 是什么样子的?

@bsuooo bsuooo added the feature: need confirm 待确认的新特性 label Apr 24, 2024
@Moonofweisheng
Copy link
Owner

目前validate方法支持x.x.x格式prop的。

@bsuooo
Copy link
Author

bsuooo commented Apr 24, 2024

目前validate方法支持x.x.x格式prop的。

image

这样写校验不通过, 需要配置什么吗?

@Moonofweisheng
Copy link
Owner

Moonofweisheng commented Apr 24, 2024 via email

@bsuooo
Copy link
Author

bsuooo commented Apr 24, 2024

这个是ts的类型错误。formState上没那个属性。这里你可以用v-model="formState.xx.xx"来做绑定,prop="xx.xx"。 ------------------ 原始邮件 ------------------ 发件人: "Moonofweisheng/wot-design-uni" @.>; 发送时间: 2024年4月24日(星期三) 上午10:04 @.>; @.@.>; 主题: Re: [Moonofweisheng/wot-design-uni] [新功能需求] form校验是否可以支持key为"xxx.xxx"形式 (Issue #257) 目前validate方法支持x.x.x格式prop的。 image.png (view on web) 这样写校验不通过, 需要配置什么吗? — Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you commented.Message ID: @.***>

不好意思, 类型是我图省事没改
这是我的数据结构:
image
这是我的template:
image
form只有一级, "username.abc" 只是一个普通的key, 这样校验是无法通过的
image

@Moonofweisheng
Copy link
Owner

这个是ts的类型错误。formState上没那个属性。这里你可以用v-model="formState.xx.xx"来做绑定,prop="xx.xx"。 ------------------ 原始邮件 ------------------ 发件人: "Moonofweisheng/wot-design-uni" @.>; 发送时间: 2024年4月24日(星期三) 上午10:04 _@**._>; _@.@._>; 主题: Re: [Moonofweisheng/wot-design-uni] [新功能需求] form校验是否可以支持key为"xxx.xxx"形式 (Issue #257) 目前validate方法支持x.x.x格式prop的。 image.png (view on web) 这样写校验不通过, 需要配置什么吗? — Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you commented.Message ID: _@_.*>

不好意思, 类型是我图省事没改 这是我的数据结构: image 这是我的template: image form只有一级, "username.abc" 只是一个普通的key, 这样校验是无法通过的 image

这样恐怕不行,'xx.xx'这种格式的prop,目前form的处理是会去找v-model绑定的formState.xx.xx的,是出于什么目的要将一级的子节点使用xx.xx命名呢?

@bsuooo
Copy link
Author

bsuooo commented Apr 24, 2024

这个是ts的类型错误。formState上没那个属性。这里你可以用v-model="formState.xx.xx"来做绑定,prop="xx.xx"。 ------------------ 原始邮件 ------------------ 发件人: "Moonofweisheng/wot-design-uni" @.>; 发送时间: 2024年4月24日(星期三) 上午10:04 _@**._>; _@.@._>; 主题: Re: [Moonofweisheng/wot-design-uni] [新功能需求] form校验是否可以支持key为"xxx.xxx"形式 (Issue #257) 目前validate方法支持x.x.x格式prop的。 image.png (view on web) 这样写校验不通过, 需要配置什么吗? — Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you commented.Message ID: _@_.*>

不好意思, 类型是我图省事没改 这是我的数据结构: image 这是我的template: image form只有一级, "username.abc" 只是一个普通的key, 这样校验是无法通过的 image

这样恐怕不行,'xx.xx'这种格式的prop,目前form的处理是会去找v-model绑定的formState.xx.xx的,是出于什么目的要将一级的子节点使用xx.xx命名呢?

低代码项目, 为了支持重复key做的操作(比如不同表的id、创建时间: "表1.id、 表2.id" 这样), web端使用的框架是ant-design-vue, 那边的prop是根据数组来进行寻找层级的, 所以不会有这个问题.

@bsuooo
Copy link
Author

bsuooo commented Apr 24, 2024

这个是ts的类型错误。formState上没那个属性。这里你可以用v-model="formState.xx.xx"来做绑定,prop="xx.xx"。 ------------------ 原始邮件 ------------------ 发件人: "Moonofweisheng/wot-design-uni" @.>; 发送时间: 2024年4月24日(星期三) 上午10:04 _@**._>; _@.@._>; 主题: Re: [Moonofweisheng/wot-design-uni] [新功能需求] form校验是否可以支持key为"xxx.xxx"形式 (Issue #257) 目前validate方法支持x.x.x格式prop的。 image.png (view on web) 这样写校验不通过, 需要配置什么吗? — Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you commented.Message ID: _@_.*>

不好意思, 类型是我图省事没改 这是我的数据结构: image 这是我的template: image form只有一级, "username.abc" 只是一个普通的key, 这样校验是无法通过的 image

这样恐怕不行,'xx.xx'这种格式的prop,目前form的处理是会去找v-model绑定的formState.xx.xx的,是出于什么目的要将一级的子节点使用xx.xx命名呢?

所以我的意思就是可不可以 prop是根据"." 来分割层级 和根据[]来区分层级(就像ant-design) 都支持, 用户自己选择 :)

@Moonofweisheng
Copy link
Owner

s

这个是ts的类型错误。formState上没那个属性。这里你可以用v-model="formState.xx.xx"来做绑定,prop="xx.xx"。 ------------------ 原始邮件 ------------------ 发件人: "Moonofweisheng/wot-design-uni" @.>; 发送时间: 2024年4月24日(星期三) 上午10:04 _@**._>; _@.@._>; 主题: Re: [Moonofweisheng/wot-design-uni] [新功能需求] form校验是否可以支持key为"xxx.xxx"形式 (Issue #257) 目前validate方法支持x.x.x格式prop的。 image.png (view on web) 这样写校验不通过, 需要配置什么吗? — Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you commented.Message ID: _@_.*>

不好意思, 类型是我图省事没改 这是我的数据结构: image 这是我的template: image form只有一级, "username.abc" 只是一个普通的key, 这样校验是无法通过的 image

这样恐怕不行,'xx.xx'这种格式的prop,目前form的处理是会去找v-model绑定的formState.xx.xx的,是出于什么目的要将一级的子节点使用xx.xx命名呢?

所以我的意思就是可不可以 prop是根据"." 来分割层级 和根据[]来区分层级(就像ant-design) 都支持, 用户自己选择 :)

之前没考虑过这个场景,有兴趣可以提个pr来。着急的话可以自行处理一下,在构造formState时将'.'先换成'_'之类的,解决当前的问题。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature: need confirm 待确认的新特性
Projects
None yet
Development

No branches or pull requests

2 participants