_slug.vue 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102
  1. <template>
  2. <div>
  3. <div class="container">
  4. <div class="columns">
  5. <div class="column is-9">
  6. <div class="section">
  7. <div class="what-you-get">
  8. <div class="what-you-get-title">
  9. What you will learn
  10. </div>
  11. <ul class="what-you-get-items">
  12. <!-- TODO: Iterate course wsl -->
  13. <li
  14. v-for="wsl in course.wsl"
  15. :key="wsl.value"
  16. class="what-you-get-item">
  17. <span>{{wsl.value}}</span>
  18. </li>
  19. </ul>
  20. </div>
  21. </div>
  22. <div class="section course-description p-t-none">
  23. <div class="course-description-title">Course Info</div>
  24. <div class="course-description-details">
  25. <!-- TODO: use v-html for description -->
  26. <div v-html="course.description"></div>
  27. </div>
  28. </div>
  29. </div>
  30. </div>
  31. </div>
  32. </div>
  33. </template>
  34. <script>
  35. export default {
  36. computed: {
  37. course() {
  38. return this.$store.state.course.item
  39. }
  40. },
  41. async fetch({store, params}) {
  42. await store.dispatch('course/fetchCourseBySlug', params.slug)
  43. }
  44. }
  45. </script>
  46. <!-- Fetch course by Slug -->
  47. <!-- 1. create action "fetchCourseBySlug" in store/course.js -->
  48. <!-- 2. send GET request '/api/v1/products/s/:slug' -->
  49. <!-- 3. expect to receive "course" in "then" and commit it to state -->
  50. <!-- 4. get course in computed properties -->
  51. <!-- 5. Complete TODO's -->
  52. <!-- 6. Navigate to detail page from home page when clicking on "Learn More" -->
  53. <style lang="scss">
  54. .what-you-get {
  55. background-color: #f9f9f9;
  56. border: 1px solid #dedfe0;
  57. padding: 10px 15px;
  58. &-title {
  59. font-size: 26px;
  60. font-weight: bold;
  61. margin-bottom: 10px;
  62. }
  63. &-items {
  64. display: flex;
  65. align-items: flex-start;
  66. justify-content: space-between;
  67. flex-wrap: wrap;
  68. }
  69. &-item {
  70. display: flex;
  71. align-items: center;
  72. margin-bottom: 10px;
  73. font-size: 17px;
  74. width: 45%;
  75. }
  76. }
  77. .course-description {
  78. &-title {
  79. font-size: 26px;
  80. font-weight: bold;
  81. margin-bottom: 10px;
  82. }
  83. &-details {
  84. font-size: 18px;
  85. ul {
  86. list-style: disc;
  87. margin-left: 20px;
  88. }
  89. ol {
  90. margin-left: 20px;
  91. }
  92. strong {
  93. font-size: 20px;
  94. }
  95. p {
  96. min-height: 30px;
  97. }
  98. }
  99. }
  100. </style>