1.0.26
http://jsbin.com/cavadiwosi/1/edit?html,js,console,output
$vm.$delete('object.key')
$vm.object.key should not exist
$vm.$set('object.key', value) seems to work fine
$vm.object.key doesn't change
$set and $delete are deprecated in the new version. Use Vue.set and Vue.delete instead.
toggleRow: function(row) {
key = row.id
if (this.selectedRows[key]) {
console.log('deleteRow: ', key)
Vue.delete(this.selectedRows, key)
}
else {
Vue.set(this.selectedRows, key, row)
}
}
Note the API only supports deleting the vm's own keys. Also, prefer Vue.delete.
@kingdaro vm.$set and $vm.delete does not seem to be deprecated in actual version 2.x https://vuejs.org/v2/api/#vm-set :)
Most helpful comment
$setand$deleteare deprecated in the new version. UseVue.setandVue.deleteinstead.