index.vue 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. <template>
  2. <v-row>
  3. <v-col cols="12" md="3">
  4. <!-- Level List -->
  5. <v-list rounded>
  6. <v-subheader>{{ chapter }}</v-subheader>
  7. <v-list-item-group color="#5588e5">
  8. <v-list-item
  9. v-for="level in levels"
  10. :key="level.levelNum"
  11. nuxt
  12. :to="`${level.to}/tutorial`"
  13. >
  14. <v-list-item-icon>
  15. <v-icon>mdi-book-variant</v-icon>
  16. </v-list-item-icon>
  17. <v-list-item-content>
  18. <v-list-item-title>{{ $t(level.name) }}</v-list-item-title>
  19. </v-list-item-content>
  20. </v-list-item>
  21. </v-list-item-group>
  22. </v-list>
  23. </v-col>
  24. </v-row>
  25. </template>
  26. <script lang="ts">
  27. import Vue from 'vue'
  28. export default Vue.extend({
  29. async asyncData({ params }) {
  30. // Get levels information of this chapter and set it in store
  31. const meta = await import(`~/docs/${params.chapter}/meta.json`)
  32. return { levels: meta.default }
  33. },
  34. computed: {
  35. chapter() {
  36. return this.$route.params.chapter
  37. }
  38. },
  39. methods: {
  40. getLevelName(rawName: string): string {
  41. const tokens = rawName.split('.')
  42. return tokens[tokens.length - 1]
  43. }
  44. }
  45. })
  46. </script>
  47. <style scoped></style>