Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
{"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