Advertisement
Guest User

Untitled

a guest
Dec 10th, 2019
143
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. store/
  2.     index.js
  3.     auth.js
  4.  
  5.  
  6. //index.js
  7.  
  8. import Vue from "vue";
  9. import Vuex from "vuex";
  10. import auth from "./auth";
  11.  
  12. Vue.use(Vuex);
  13.  
  14. export default new Vuex.Store({
  15.   modules: {
  16.     auth
  17.   }
  18. });
  19.  
  20.  
  21. auth.js
  22.  
  23. export default {
  24.   namespaced: true,
  25.   state: {
  26.     todos: [
  27.       { id: 1, text: "jedne", done: true },
  28.       { id: 2, text: "dwa", done: false }
  29.     ]
  30.   },
  31.   getters: {
  32.     show: state => {
  33.       return state.todos.filter(todo => todo.done);
  34.     },
  35.     test: state => {
  36.       return state.test;
  37.     }
  38.   },
  39.   mutations: {},
  40.   actions: {}
  41. };
  42.  
  43. //app.js
  44.  
  45. require("./bootstrap");
  46.  
  47. window.Vue = require("vue");
  48. import router from "./router";
  49. import store from "./store";
  50. import Index from "./Index";
  51.  
  52. const app = new Vue({
  53.   el: "#app",
  54.   router,
  55.   store,
  56.   components: {
  57.     Index
  58.   }
  59. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement