Advertisement
Guest User

Untitled

a guest
Oct 22nd, 2019
98
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.61 KB | None | 0 0
  1. // For Nuxtjs and Gridsome:
  2. <template>
  3. <div>
  4. <div v-html="richtext"></div>
  5. </div>
  6. </template>
  7.  
  8. <script>
  9. export default {
  10. props: ['text'],
  11. computed: {
  12. richtext() {
  13. return this.text ? this.$storyapi.richTextResolver.render(this.text) : ''
  14. }
  15. }
  16. }
  17. </script>
  18.  
  19. // Universal for Vuejs:
  20. <template>
  21. <div>
  22. <div v-html="richtext"></div>
  23. </div>
  24. </template>
  25.  
  26. <script>
  27. import Storyblok from 'storyblok-js-client'
  28. const Api = new Storyblok()
  29.  
  30. export default {
  31. props: ['text'],
  32. computed: {
  33. richtext() {
  34. return this.text ? Api.richTextResolver.render(this.text) : ''
  35. }
  36. }
  37. }
  38. </script>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement