NEXT craftinamerica.org. Base setup for headless wordpress https://www.craftinamerica.org
Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. <template lang="pug">
  2. .block.gallery(v-if="block.hasOwnProperty('gallery')")
  3. p place-holder gallery {{ block.gallery }}
  4. .block.embed(v-else-if="block[0].blockName == 'core/embed'")
  5. figure.youtube(v-if="block[0].attrs.providerNameSlug == 'youtube'").is-provider-youtube.wp-block-youtube
  6. p youtube: {{ fixYoutubeUrl(block[0].attrs.url) }}
  7. iframe(
  8. :src="fixYoutubeUrl(block[0].attrs.url)"
  9. title="YouTube video player"
  10. frameborder="0"
  11. allowfullscreen
  12. ).embed--player
  13. .not-youtube(v-else)
  14. p not youtube: {{ block[0].attrs }}
  15. rblock(v-else-if="typeof block === 'object'" :block="block")
  16. .block.single(v-else)
  17. .single--content(v-html="block")
  18. </template>
  19. <script>
  20. import rblock from './block-recursive'
  21. export default {
  22. components: { rblock },
  23. props: {
  24. block: { required: true }
  25. },
  26. methods: {
  27. fixYoutubeUrl(url) {
  28. const videoUid = url.split('https://youtu.be/').filter(pieces => pieces.length > 0)[0]
  29. return `https://www.youtube.com/embed/${videoUid}`
  30. }
  31. },
  32. data() {
  33. return {
  34. }
  35. },
  36. computed: {
  37. }
  38. }
  39. </script>
  40. <style lang="postcss">
  41. .block
  42. &.embed
  43. min-height: 40vh
  44. > figure.youtube, > figure.youtube iframe
  45. height: 40vh
  46. width: 100%
  47. </style>