I have a button in a Vue component
<el-button class='range-right' @click='deleteItem(item)'>delete</el-button>
within it's handler I want to invoke other methods of the component.
however, even though I can call deleteItem
which is itself a component method, I cannot get at the actual component for other methods.
is there a way to pass something like a $component
param to the @click
event?
methods {
deleteItem: (item, obj) => {
let api = '/api/train/deleteItem?_id=' + item._id
let resource = Vue.resource(api)
let vm = this // NOT a component
window.delItem = this
console.log('deleteItem.this', this)
resource.delete(api)
.then(items => {
console.log('deleted')
vm.methods.load() //<< fails
})
},