Guest User

Untitled

a guest
Jan 16th, 2019
62
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.17 KB | None | 0 0
  1. <template>
  2. <div id="app">
  3. <div id="nav" class="wrapper flex-col flex-col--align-center">
  4. <h1 class="flex-col--2">MyStore</h1>
  5. <div class="flex-col--2 nav-items">
  6. <router-link to="/" class="nav-items__item">Home</router-link>
  7. <router-link to="/cart" class="nav-items__item">
  8. Cart
  9. <counter-badge :count="cartCount"></counter-badge>
  10. </router-link>
  11. </div>
  12. </div>
  13. <router-view/>
  14. </div>
  15. </template>
  16.  
  17. <script>
  18. import CounterBadge from '@/components/CounterBadge';
  19.  
  20. export default {
  21. name: 'app',
  22. components: { CounterBadge },
  23. computed: {
  24. cartCount() {
  25. return this.$store.state.cart.length
  26. }
  27. }
  28. }
  29. </script>
  30.  
  31. <style lang="scss">
  32. #app {
  33. font-family: 'Avenir', Helvetica, Arial, sans-serif;
  34. -webkit-font-smoothing: antialiased;
  35. -moz-osx-font-smoothing: grayscale;
  36. color: #2c3e50;
  37. }
  38. #nav {
  39. padding: 30px;
  40. a {
  41. font-weight: bold;
  42. color: #2c3e50;
  43. &.router-link-exact-active {
  44. color: #42b983;
  45. }
  46. }
  47. }
  48. .nav-items {
  49. justify-content: flex-end;
  50. display: flex;
  51. }
  52. .nav-items__item {
  53. margin-left: 1rem;
  54. position: relative;
  55. }
  56. ul {
  57. padding-left: 0;
  58. list-style: none;
  59. }
  60. </style>
Add Comment
Please, Sign In to add comment