Created
February 22, 2018 04:45
-
-
Save Rayraegah/78afc345baf2492c43fd37fc9df9f956 to your computer and use it in GitHub Desktop.
Try it online! https://codepan.net/gist/78afc345baf2492c43fd37fc9df9f956
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{"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