尝试根据服务器响应更新vue属性的值:
@registration = new Vue(
el: '#calculator_calendar'
data:
constraints:
amount:
min: null
max: null
以及我做GET请求的方法
loadConstraints: () ->
@$http.get(constraintsUrl).then ((response) ->
@$set 'constraints.amount.min', response.data.constraints.amount.min
更新constraints.amount,min
的正确语法是什么。
旧版本用于
@$set 'constraints.amount.min', response.data.constraints.amount.max
但它不再起作用,
失败Uncaught (in promise) TypeError: Cannot create property '100' on string 'constraints.amount.min'
版本:
答案 0 :(得分:1)
您可以分配它,就像在javascript中完成一样:
loadConstraints: () => {
var vm = this
$http.get(constraintsUrl).then ((response) =>
vm.constraints.amount.min' = response.data.constraints.amount.min