[Vuejs]-Bind Vuejs select boxes to Rails

0👍

Solved this by re-initializing the values of checkedAmenities on mount:

mounted: function() {
  var newArray = []
  for(var i = 0; i < this.amenities.length; i++){
    if(this.checkedAmenities.includes(this.amenities[i].text)) {
      newArray.push(true)
    } else {
      newArray.push(false)
    }
  }
  this.checkedAmenities = newArray
}

Seems to do the trick

Leave a comment