如何在JS中执行动态值

时间:2018-09-28 13:40:28

标签: javascript

<script>
var widgetsBelow=[{
        "name": "alfresco/renderers/CustomProperty",
        "config": {
            "label": "Product Title",
            "propertyToRender": "node.properties.cbib:title"
        }
    },
    {
        "name": "alfresco/renderers/CustomProperty",
        "config": {
            "label": "Author",
            "propertyToRender": "node.properties.cbib:author"
        }
    }
];

var currentItem=[{
        "name": "alfresco/renderers/CustomProperty",
        "node": {
            "properties": {
                "cbib:title": "product title"
            }
        }
    },
    {
        "name": "alfresco/renderers/CustomProperty",
        "node": {
            "properties": {
                "cbib:author": "author"
            }
        }
    }
];

            for(var i=0;i<this.widgetsBelow.length;i++)
                 {
                    var val=this.widgetsBelow[i].config.propertyToRender;
                        console.log("propertyToRender:"+val);

                        console.log("val.."+ currentItem[i].val);



                 }

                 </script>

已经定义了两个JSON数组。当我尝试将一个人的输出追加到另一个输入时,其显示为undefined。propertyToRender显示的是值,而currentItem [val]为未定义的。如何在JS中执行动态值?

0 个答案:

没有答案