Editorial.vue;
<templates>
<div >
<router-link to="editorial">
<base-button type="info" @click="saveUserData">Save</base-button>
</router-link>
</div>
</templates>
data() {
return {
userdetails: {
logoURL: null
}
}
},
methods: {
saveUserData: function () {
let formData = new FormData()
formData.append('logoURL', this.userdetails.logoURL)
this.api.uploadFile('editorial/' store.state.journalId '/editorialimage'
,formData'journals/v1/').then((res) => {
this.userdetails.journalId = store.state.journalId
this.userdetails.imageId = res.data.status
this.createNewMember()
}, (err) => {
console.log(err)
})
},
When I click save button I'm getting the below error
"Invalid handler for event "click": got undefined
found in
---> <BaseButton> at src/components/BaseButton.vue
<RouterLink>
<Card> at src/components/Cards/Card.vue
<Anonymous>
<ZoomCenterTransition>
<DashboardLayout> at src/pages/Layout/DashboardLayout.vue
<App> at src/App.vue
<Root>"
"I'm getting the above error I don't the solution, the function name also mentioned correctly but still I'm getting the same error. Searched some of the solution but nothing worked. The function posting some data to the server but while clicking the button getting the error". Tried lots of ways to solve this but its all failed.
"I'm getting the above error I don't the solution, the function name also mentioned correctly but still I'm getting the same error. Searched some of the solution but nothing worked. The function posting some data to the server but while clicking the button getting the error". Tried lots of ways to solve this but its all failed.
CodePudding user response:
What is that base-button
? if that a custom component, you need to define emit
event from the component, so the parent can catch the event and fire the saveUserData
function
you might be want to provide some information about your custom component
here some detail how to use emit
https://vuejs.org/guide/components/events.html