[vuex] expects string as the type, but found undefined.

2022. 6. 6. 01:37ใ†๊ฐœ๋… ์ •๋ฆฌ ์ž‘์—…์‹ค/๋ฌธ์ œ ์ •๋ฆฌ

728x90
๋ฐ˜์‘ํ˜•

 

โš ๏ธ ๋ฌธ์ œ ๋ฐœ์ƒ!

 

 

๐Ÿค” ์›์ธ ๋ถ„์„

/pages/cart.vue

 

๋ฐ˜์‘ํ˜•

 

 

/store/index.js

 

dispatch()๋ฅผ ํ˜ธ์ถœํ•  ๋•Œ, ์œ ์˜ํ•ด์•ผ ํ•˜๋Š” ๊ฒƒ์ด Actions์— ์„ ์–ธํ•œ ํ•จ์ˆ˜๋ช…๊ณผ ์™„์ „ํžˆ ์ผ์น˜ํ•ด์•ผ ํ•œ๋‹ค๋Š” ๊ฒƒ์ž…๋‹ˆ๋‹ค.
๋งŒ์•ฝ ์ผ์น˜ํ•˜์ง€ ์•Š์œผ๋ฉด ์œ„์™€ ๊ฐ™์€ ๋ฌธ์ œ๊ฐ€ ๋ฐœ์ƒํ•˜๊ฒŒ ๋ฉ๋‹ˆ๋‹ค.

 

 

 

๐Ÿป ๋ฌธ์ œ ํ•ด๊ฒฐ!

/pages/cart.vue

 

์•„๊นŒ ์œ„์—์„œ /store/index.js์— Actions์—์„œ ์‚ฌ์šฉํ•  ํ•จ์ˆ˜๋ช…์„ ์ƒ์ˆ˜ํ˜•์œผ๋กœ ๋งŒ๋“œ๋Š” ๊ฒƒ์ด ์ข‹์€๋ฐ, ๊ทธ ์ด์œ ๋Š”  ์œ„์™€ ๊ฐ™์ด ์ด๋ฆ„์ด ํ‹€๋ฆด ๊ฒฝ์šฐ๊ฐ€ ์žˆ๊ณ , ์„œ๋น„์Šค๊ฐ€ ์ปค์ง€๊ฒŒ ๋˜๋ฉด ์ด๋ฆ„์ด ํ—ท๊ฐˆ๋ฆด ์ˆ˜๊ฐ€ ์žˆ๊ธฐ ๋•Œ๋ฌธ์ด๋ž๋‹ˆ๋‹ค.

 

 

 

 

728x90
๋ฐ˜์‘ํ˜•