[英]How do I create a methods that map my JSON object to set properties of data object in vue.js?
[英]How do I create a single JSON object with multiple attributes/properties?
我需要创建一个名为args的JSON对象,它具有2个属性/属性,key1和key2。
目前这是我所拥有的,但无法正确解析...
var args:{
'key1': $scope.args.users,
'key2': 'http://financialsystems.sungard.com/'
}
其中$ scope.args.users是一个数组:
$scope.args.users = [
{id: '1', firstName: 'Geraldine', lastName: 'Roberts', email: 'geraldine.roberts@email.com', country: 'South Africa'},
{id: '2', firstName: 'Walter', lastName: 'Mitty', email: 'w.mitty@email.com', country: 'USA'}
];
我要去哪里错了? 每个属性/属性周围是否应该有另一套花括号?
{}
args
必须是"args"
"
not '
引号'key1'
必须为"key1"
, "key1"
这样:
{
"args": {
"key1": [
{
"id": "1",
"firstName": "Geraldine",
"lastName": "Roberts",
"email": "geraldine.roberts@email.com",
"country": "South Africa"
},
{
"id": "2",
"firstName": "Walter",
"lastName": "Mitty",
"email": "w.mitty@email.com",
"country": "USA"
}
],
"key2": "http://financialsystems.sungard.com/"
}
}
替换:
至=
var args = {
'key1': $scope.args.users,
'key2': 'http://financialsystems.sungard.com/'
};
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.