2017-06-09 7 views
0

commented_type列の評価値のみを更新する必要があります。 Laravelで私はそのようなcommented_type>評価のために使用しています。しかし、私はvue.jsのやり方を知らない。このようなVue.js:db内の子jsonデータ形式を更新

JSONコラム:

commented_type 
{"type": "review", "rating": 5} 



updateReview: function() { 
    var reviewData = { 
     id:584, 
     commented_type>rating:'4',//It does not work like that 
    }; 
    this.$http.patch('/review/584',reviewData).then((response) => { 

     console.log(response.data); 

    }, (response) => { 
     // error callback 
     console.log('error response review update') 
    }); 
}, 

答えて

0

はあなたのJSON文字列の形式で、現在ですか?オブジェクトを取得する必要がある場合は、JavaScriptのJSON.parse()を使用してみてください。

それ以外の場合は、JSのproperty accessorsについて質問しているようです。試してみてください:

commented_type['rating']