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

anyof, oneof的title和description会渲染两次 #280

Open
Jaden-47 opened this issue Mar 16, 2023 · 3 comments
Open

anyof, oneof的title和description会渲染两次 #280

Jaden-47 opened this issue Mar 16, 2023 · 3 comments

Comments

@Jaden-47
Copy link

Jaden-47 commented Mar 16, 2023

反馈问题请先查看文档和务必提供详细的复现代码,遵循如下格式,描述不清楚的问题将会直接关闭。

vue和ui框架

vue3、ui框架element plus、vjsf 版本"@lljj/vue3-form-element": "^1.14.2"

问题描述

anyof, oneof的子选项里的title和description会被父级单位的title和description覆盖

如何复现,以playground的anyof为例子

"age": {
            "title": "age",
            "description": "some description",
            "anyOf": [
                {
                    "title": "M 5",
                    "type": "integer",
                    "description": "different description 1",
                    "multipleOf": 5
                },
                {
                    "title": "M 3",
                    "description": "different description 1",
                    "type": "integer",
                    "multipleOf": 3
                }
            ],
            "anyOfSelect": {
                "ui:widget": "RadioWidget",
                "ui:title": "选择选项",
                "ui:options": {}
            }
        }

如上述代码,在playground表现正常,age的title为"age",而下两个子选项的title分别是"M 5"和"M 3", 且description也显示正常。但是在我的环境中(vue3+element plus+electron)下两个子选项的title和description会被age的title和description覆盖

必要时提供复现demo,如codepen,github 复现仓库,playground分享链接等

期望的结果

期望结果应该和playground里一样,title和description都显示自己组件的属性值,除非为空才显示父组件的属性值

@Jaden-47
Copy link
Author

如果用ui:title和ui:description来设置age,甚至age本身的title和description都会消失。

@Jaden-47
Copy link
Author

  • ui:description好像和文档中使用方法不符应该是ui:showDescription
    image

  • 这个问题看起来是和issue#256是类似的问题,只不过我是使用oneof和oneOfSelect

"sample_data": {
            "type": "object",
            "properties": {
                "value": {
                    "title": "value",
                    "description": "<span style='font-weight:bold'>value: </span><ul style='list-style-type:disc;padding-left:20px'><li><span style='font-weight:bold'>预设值: </span> [] </li></ul>",
                    "default": [],
                    "buffer": {
                    "oneOf": [
                        {
                            "type": "string"
                        },
                        {
                            "type": "array",
                            "ui:showTitle": true,
                            "ui:showDescription": true,
                            "items": {
                                "type": "number",
                                "description": "范围在uint8之内",
                                "minimum": 0,
                                "maximum": 255
                            }
                        }
                    ],
                    "oneOfSelect": {
                        "ui:widget": "RadioWidget",
                        "ui:enumOptions": [
                            {
                                "label": "字符串",
                                "value": 0
                            },
                            {
                                "label": "u8数组",
                                "value": 1
                            }
                        ]
                    }
                }
                }
            }
        }

会导致description有重复,猜测问题的来源是渲染value object的时候用了一遍description,然后渲染oneof的子组件又用了一遍description
image

@Jaden-47 Jaden-47 changed the title anyof, oneof的title和description会被父级单位的title和description覆盖 anyof, oneof的title和description会渲染两次 Mar 17, 2023
@lljj-x
Copy link
Owner

lljj-x commented Mar 22, 2023

#256 这个是有问题,这周修复吧

这个我到时一起看下

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