首页 > 解决方案 > 基于 ember octane 中选择的答案的基于条件的显示部分

问题描述

我有一个带有多个部分的 JSON 数据,其中部分将在用户单击下一个按钮后显示。在这里我需要添加条件(例如:如果用户在第 1 部分中为问题选择“是”,在第 3 部分中我们将添加条件作为条件将有问题和值如果值为是并且对于相同的问题现在选择所有字段并单击下一个用户需要跳过第2节并向他显示第3节)。由于我对 ember octane 非常陌生,因此遇到了这个特殊问题

{
    "deadline": "2020-10-02T09:30:13+05:30",
    "formType": "One time",
    "questions": [
        {
            "condition": {},
            "questions": [
                {
                    "type": "currency",
                    "options": [
                        ""
                    ],
                    "helpText": "",
                    "question": "How Many Products do you sell",
                    "required": false,
                    "indicator": "dfsff_0_0",
                    "responseType": "number"
                },
                {
                    "type": "boolean",
                    "options": [
                        ""
                    ],
                    "helpText": "",
                    "question": "Are you in profits",
                    "required": false,
                    "indicator": "dfsff_0_1",
                    
                },
                {
                    "type": "dropdown",
                    "options": [
                        "sdsd",
                        "sdsdddsd"
                    ],
                    "helpText": "",
                    "question": "dsds",
                    "required": false,
                    "indicator": "dfsff_0_2",
                    "responseType": ""
                }
            ],
            "sectionTitle": "section 1"
        },
        {
            "condition": {
                "value": "true",
                "indicator": "dfsff_0_1"
            },
            "questions": [
                {
                    "type": "date",
                    "options": [
                        ""
                    ],
                    "helpText": "",
                    "question": "Loss ?",
                    "required": true,
                    "indicator": "trewq_1_0",
                    "responseType": ""
                },
                {
                    "type": "boolean",
                    "options": [
                        ""
                    ],
                    "helpText": "",
                    "question": "",
                    "required": false,
                    "indicator": "trewq_1_1",
                    "responseType": ""
                }
            ],
            "sectionTitle": "section 2"
        },
        {
            "condition": {
                "value": "false",
                "indicator": "trewq_1_1"
            },
            "questions": [
                {
                    "type": "currency",
                    "options": [
                        ""
                    ],
                    "helpText": "dsds",
                    "question": "dsdsd",
                    "required": true,
                    "indicator": "dsd_2_0",
                    "responseType": "number"
                }
            ],
            "sectionTitle": "section 3"
        }
    ]
}

标签: ember-octane

解决方案


推荐阅读