Skip to content

Instantly share code, notes, and snippets.

@Rayraegah
Created February 22, 2018 04:45
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Rayraegah/78afc345baf2492c43fd37fc9df9f956 to your computer and use it in GitHub Desktop.
Save Rayraegah/78afc345baf2492c43fd37fc9df9f956 to your computer and use it in GitHub Desktop.
{"js":{"code":"const store = new Vuex.Store({\n state: {\n num: 0\n },\n \n mutations: {\n plus: (state) => {\n state.num += 1\n },\n \n minus: (state) => {\n state.num -= 1\n }\n }\n});\n\nconst app = new Vue({\n name: \"App\",\n \n template: `\n <div>\n <p>{{num}}</p>\n <button @click=\"plus\">+</button>\n <button @click=\"minus\">-</button>\n </div>\n `,\n \n computed: { ...store.mapState([\"num\"]) },\n methods: { ...store.mapMutations([\"plus\", \"minus\"]) }\n});\n\napp.$mount(\"#app\");\n","transformer":"js"},"css":{"code":"","transformer":"css"},"html":{"code":"<!DOCTYPE html>\n<html>\n<head>\n <meta charset=\"utf-8\">\n <meta name=\"viewport\" content=\"width=device-width\">\n <title>Vuex-lite - demo</title>\n <script src=\"https://unpkg.com/vue@2.5.13/dist/vue.js\"></script>\n <script src=\"https://unpkg.com/vuex-lite@0.1.2/dist/vuex-lite.min.js\"></script>\n</head>\n<body>\n <div id=\"app\"></div>\n</body>\n</html>","transformer":"html"},"showPans":["html","js","console","output"],"activePan":"js"}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment