Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

$vm.$delete('object.key') doesn't work #3368

Closed
franciscolourenco opened this issue Aug 1, 2016 · 3 comments
Closed

$vm.$delete('object.key') doesn't work #3368

franciscolourenco opened this issue Aug 1, 2016 · 3 comments

Comments

@franciscolourenco
Copy link
Contributor

franciscolourenco commented Aug 1, 2016

Vue.js version

1.0.26

Reproduction Link

http://jsbin.com/cavadiwosi/1/edit?html,js,console,output

Steps to reproduce

$vm.$delete('object.key')

What is Expected?

$vm.object.key should not exist
$vm.$set('object.key', value) seems to work fine

What is actually happening?

$vm.object.key doesn't change

@itsMapleLeaf
Copy link
Contributor

itsMapleLeaf commented Aug 1, 2016

$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)
  }   
}

@yyx990803
Copy link
Member

yyx990803 commented Aug 1, 2016

Note the API only supports deleting the vm's own keys. Also, prefer Vue.delete.

@luckylooke
Copy link

luckylooke commented Apr 17, 2020

@kingdaro vm.$set and $vm.delete does not seem to be deprecated in actual version 2.x https://vuejs.org/v2/api/#vm-set :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants