1、需求
<el-button v-for="button in buttonArr" @click="buttonMethods(button.function)">{{button.label}}</el-button>
其中buttonMethods 里的参数为该按钮实际调用的method
2、解决方案
buttonMethods (funcName) {
let methods = this.$options.methods
methods[funcName]()
}
其中 this.$options.methods是查询该组件下的所有method