Library.vue 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. <template>
  2. <component-debug :component="this" class="view">
  3. <div class="py-3">
  4. <b-button @click="openText">
  5. add text 50
  6. </b-button>
  7. </div>
  8. <!-- BACKGROUND (mode) -->
  9. <component :is="mode" />
  10. <!-- FOREGROUND (texts) -->
  11. <section v-for="group in groups" :key="group.id" class="split-screen">
  12. <text-card :id="group.id" />
  13. <div>
  14. <text-card v-for="id in group.prod" :key="id" :id="id" />
  15. </div>
  16. </section>
  17. </component-debug>
  18. </template>
  19. <script>
  20. import { CardList, CardMap, TreeMap } from './library'
  21. import TextCard from '@/components/text/TextCard'
  22. export default {
  23. name: 'Library',
  24. components: {
  25. CardList,
  26. CardMap,
  27. TreeMap,
  28. TextCard
  29. },
  30. metaInfo () {
  31. return {
  32. title: this.groups.length ? 'Bibliothèque - ' + this.groups[0].id : 'Bibliothèque',
  33. meta: [
  34. { charset: 'utf-8' },
  35. { name: 'viewport', content: 'width=device-width, initial-scale=1' }
  36. ]
  37. }
  38. },
  39. props: {
  40. mode: { type: String, required: true },
  41. texts: { type: Array, required: true }
  42. },
  43. computed: {
  44. groups () {
  45. return this.texts.map(text => {
  46. const [id, ...prod] = text
  47. return { id, prod }
  48. })
  49. }
  50. },
  51. methods: {
  52. openText () {
  53. this.$router.push({
  54. query: {
  55. mode: this.mode,
  56. texts: [...this.texts, [50]]
  57. }
  58. })
  59. }
  60. }
  61. }
  62. </script>
  63. <style lang="scss" scoped>
  64. </style>