![](/img/trans.png)
[英]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.