vue 中怎么配置新增或编辑不显示某一项?

怎么配置才能让身份证照片在新增中不显示??找了好久

// 新增、编辑
const Upsert = useUpsert({
    items: [
        // 分组
        {
            type: "tabs",
            props: {
                type: "card",
                labels: [
                    {
                        label: "基础",
                        value: "base"
                    },
                    {
                        label: "其他",
                        value: "other"
                    }
                ]
            }
        },
        {
            label: "头像",
            prop: "avatar",
            group: "base",
            component: {
                name: "cl-upload"
            }
        },
        // 动态值
        () => {
            return {
                label: "姓名",
                prop: "name",
                required: true,
                group: "base",
                component: {
                    name: "el-input"
                }
            };
        },
        {
            label: "年龄",
            group: "base",
            prop: "age",
            component: {
                name: "el-input-number"
            }
        },
        {
            label: "职业",
            prop: "occupation",
            group: "other",
            component: {
                name: "el-tree-select",
                props: {
                    data: dict.get("occupation"),
                    checkStrictly: true
                }
            }
        },
        {
            label: "身份证照片",
            prop: "idCardPic",
            group: "other",
            component: {
                name: "cl-upload",
                props: {
                    isSpace: true,
                    size: [200, 300]
                }
            }
        }
    ],

    // 插件
    plugins: [
        // 自动聚焦
        setFocus("name")
    ]
});
阅读 1.8k
2 个回答
新手上路,请多包涵

没太理解你的问题,你是想展示身份证照片这个功能,但不想这个功能里有照片吗?

你之提供了 jsonscheme ,没有提供渲染器代码。

你可以找找渲染器上是否有 v-show 或者 v-if 之类的东西。

如果没有的话,你可以使用 // 动态值 () => { 来处理,当新增时,返回一个无效内容。

本文参与了SegmentFault 思否面试闯关挑战赛,欢迎正在阅读的你也加入。
推荐问题