Answer the question
In order to leave comments, you need to log in
How to dynamically change the name of a called function in a Vue component?
There is a component where there is a handler that calls a function.
Example:
Vue.component('vm-table', {
props: ['list'],
template: '<button v-on:click="$root.aaa()">Редактировать</button>'
});
Answer the question
In order to leave comments, you need to log in
<template>
<button @click="edit()">Редактировать</button>
</template>
<script>
export default {
props: {
list: {
type: Object,
required: true
}
},
methods: {
edit () {
if (this.list.functionName === 'aaa') this.$root.aaa()
}
}
}
</script>
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question