App.vue 852 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. <template>
  2. <div id="app">
  3. <div id="nav">
  4. <router-link to="/">Home</router-link> |
  5. <router-link to="/about">About</router-link>
  6. </div>
  7. <router-view />
  8. <button @click="increment">Increment</button>
  9. <button @click="decrement">Decrement</button>
  10. {{ count }}
  11. </div>
  12. </template>
  13. <script>
  14. import { mapActions, mapState } from 'vuex'
  15. export default {
  16. name: 'Home',
  17. computed: {
  18. ...mapState(['count'])
  19. },
  20. methods: {
  21. ...mapActions(['increment', 'decrement'])
  22. }
  23. }
  24. </script>
  25. <style>
  26. #app {
  27. font-family: 'Avenir', Helvetica, Arial, sans-serif;
  28. -webkit-font-smoothing: antialiased;
  29. -moz-osx-font-smoothing: grayscale;
  30. text-align: center;
  31. color: #2c3e50;
  32. }
  33. #nav {
  34. padding: 30px;
  35. }
  36. #nav a {
  37. font-weight: bold;
  38. color: #2c3e50;
  39. }
  40. #nav a.router-link-exact-active {
  41. color: #42b983;
  42. }
  43. </style>