我$vs.notify
用来显示来自 db 的消息。所以想到在actions.js中使用它。但得到错误为TypeError: Cannot read property 'notify' of undefined
. 有什么方法可以在 action.js 文件中使用它。使用的代码在这里:
addTag({
commit
}, tag) {
return new Promise((resolve, reject) => {
Vue.prototype.$http.post('/tags/add/', {
tag
})
.then((response) => {
commit('ADD_TAG', Object.assign(response.data.data[0]))
Vue.prototype.$vs.notify({
title: 'Success',
text: `tag-${response.data.data[0].name} added suceesfully`,
iconPack: 'feather',
icon: 'icon-alert-circle',
color: 'success'
})
resolve(response)
})
.catch((error) => {
reject(error)
})
})
}