【发布时间】:2020-07-30 11:58:38
【问题描述】:
我正在尝试将操作作为组件中的方法访问,但出现错误
this.delete_notifaction 不是函数
notifaction.js
export const actions = {
add_notifaction({ commit }, notifaction) {
commit("ADD_NOTIFACTION", notifaction);
},
delete_notifaction({ commit }, notificationToRemove) {
commit('DELETE_NOTIFACTION', notificationToRemove)
}
};
store/index.js
modules : {
notifaction
},
Component.vue
methods: mapActions('notifaction',["delete_notifaction"]),
mounted() {
this.delete_notifaction(this.notification);
}
有什么帮助吗?
【问题讨论】:
-
您能否检查一下您的组件定义中是否只有一个
methods部分?
标签: vue.js