自定义组件返回参数校验问题
tianzhu1992 opened this issue · 14 comments
@tianzhu1992 did you solve it?
@tianzhu1992 不好意思,忘记处理问题了,el-cascader 获取的数据类型是 array,旧版本不支持 Object 或者 Array 的自定义组件,2.7.0 版本已支持,你把例子中 fruit 的 type 改为 array
即可
@tianzhu1992 did you solve it?
Try 0.2.7, change fruit's type from string
to array
can solve this issue.
@chenquincy what about 'string' field with custom el-date?
@chenquincy According to your ideas, I have written a new one myself. Thank you for your ideas
@chenquincy According to your ideas, I have written a new one myself. Thank you for your ideas
@tianzhu1992 sorry for late.
@chenquincy what about 'string' field with custom el-date?
@szymonsterczewski Change 'string' to 'date' will work.(ps: there is no el-date
, maybe you means el-date-picker
)
@chenquincy Thanks for answer, I tried this way, but I need format 2020-09-01 (yyyy-MM-dd) without time. There is the same problem as in case of @tianzhu1992
@chenquincy Thanks for answer, I tried this way, but I need format 2020-09-01 (yyyy-MM-dd) without time. There is the same problem as in case of @tianzhu1992
@szymonsterczewski I have tried your case.
const descriptors = {
date: {
type: 'date',
message: 'please choose the date',
required: true,
component: {
name: 'el-date-picker',
props: {
format: 'yyyy-MM-dd',
'value-format': 'yyyy-MM-dd'
}
}
}
}
This descriptors
work well.
@szymonsterczewski This issue will be closed later without other questions.
@chenquincy I am trying to build backend dynamic forms which will be rendered by your component.
First version:
public $type = 'string';
public $component = [
"name" => 'el-date-picker',
"type" => 'date',
"format" => "yyyy-MM-dd",
];
You are right. My mistake is in nested component, it should be:
Fixed version
public $type = 'string';
public $component = [
"name" => 'el-date-picker',
"type" => 'date',
"props" => [
"format" => "yyyy-MM-dd",
],
];
Thank you very much.
@chenquincy Oh! this is my real problem, it is causing this error. Even if it's displayed properly.
@chenquincy Thanks for answer, I tried this way, but I need format 2020-09-01 (yyyy-MM-dd) without time. There is the same problem as in case of @tianzhu1992
@szymonsterczewski I have tried your case.
const descriptors = { date: { type: 'date', message: 'please choose the date', required: true, component: { name: 'el-date-picker', props: { format: 'yyyy-MM-dd', 'value-format': 'yyyy-MM-dd' } } } }This
descriptors
work well.
@szymonsterczewski Add value-format prop, if you want to get a string value.
Works, thank you again.