index.vue 790 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. <template>
  2. <div class="simple-video-player">
  3. <van-popup v-model="show" position="center" :closeable="true">
  4. <div class="pupup-content">
  5. <video :src="videoSrc" controls ref="video" class="video"></video>
  6. </div>
  7. </van-popup>
  8. </div>
  9. </template>
  10. <script>
  11. export default {
  12. props: {
  13. videoSrc: {
  14. type: String,
  15. default: '',
  16. },
  17. },
  18. data() {
  19. return {
  20. show: false,
  21. }
  22. },
  23. watch: {
  24. show(nVal) {
  25. nVal ? this.$refs.video.play() : this.$refs.video.pause()
  26. },
  27. },
  28. methods: {
  29. open() {
  30. this.show = false
  31. },
  32. },
  33. }
  34. </script>
  35. <style scoped lang="scss">
  36. .simple-video-player {
  37. .pupup-content {
  38. width: 100vw;
  39. background: #000;
  40. }
  41. .video {
  42. margin: 0 auto;
  43. height: 100vh;
  44. }
  45. }
  46. </style>