_slug.vue 933 B

12345678910111213141516171819202122232425262728293031323334353637383940
  1. <template>
  2. <div class="blog-editor-container">
  3. <div class="container">
  4. <div class="blog-section-user">
  5. <user-tile
  6. :name="blog.author.name"
  7. :avatar="blog.author.avatar"
  8. :date="blog.createdAt | formatDate"
  9. />
  10. </div>
  11. <!-- <div class="blog-content" v-html="blog.content"></div> -->
  12. <editor-view :initialContent="blog.content" />
  13. </div>
  14. </div>
  15. </template>
  16. <script>
  17. import UserTile from '~/components/shared/UserTile'
  18. import EditorView from "~/components/editor/EditorView";
  19. export default {
  20. components: {
  21. UserTile,
  22. EditorView
  23. },
  24. computed: {
  25. blog() {
  26. return this.$store.state.blog.item
  27. }
  28. },
  29. async fetch({store, params}) {
  30. await store.dispatch('blog/fetchBlogBySlug', params.slug)
  31. }
  32. }
  33. </script>
  34. <style scoped lang="scss">
  35. .blog-content, .blog-section-user {
  36. max-width: 800px;
  37. margin: 10px auto;
  38. }
  39. </style>