Vue Store

์ด๋ฒคํŠธ ์ „๋‹ฌ

๋™๊ธฐ์‹ ์ด๋ฒคํŠธ ์ „๋‹ฌ

store.commit('syncFunc');
new Vuex.Store({
  state: {},
  mutations: {
    // ๋ฐ˜๋“œ์‹œ ํ•จ์ˆ˜ํ˜•์ด์—ฌ์•ผ ํ•œ๋‹ค.
    syncFunc: (state) => {
      /* statement */
    }
  }
});

๋น„๋™๊ธฐ ์ด๋ฒคํŠธ ์ „๋‹ฌ

store.dispatch('asyncFunc');
new Vuex.Store({
  state: {},
  actions: {
    // ๋ฐ˜๋“œ์‹œ ํ•จ์ˆ˜ํ˜•์ด์—ฌ์•ผ ํ•˜๋ฉฐ ํด๋กœ์ ธ๋‚˜ ์Šค์ฝ”ํ”„์ฒด์ธ์˜ ๋ณด์žฅ์ด ์–ด๋ ต๋‹ค.
    asyncFunc: (state) => {
      /* statement */
    }
  }
});