Error Handling
Vue error 해결법: 'mapActions' is not defined no-undef
고수트
2021. 1. 21. 20:51
반응형
vue에서 'mapActions' 를 사용하고 싶을때에
...mapActions(['login'])
아래와 같은 에러가 뜨는 경우가 있다.
'mapActions' is not defined no-undef
이 에러의 이유는 위쪽에 mapActions 해당 펑션을 호출하는것을 잊어 버리고 바로 사용하려 할때 발생한다.
따라서 import 를 통해 아래와 같이 vuex 에서 호출해주면 된다.
import {mapActions} from 'vuex'
export default {
methods: {
...mapActions(['login']),
}
}
반응형