index.vue 829 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  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. this.$nextTick(() => {
  26. nVal ? this.$refs.video.play() : this.$refs.video.pause()
  27. })
  28. },
  29. },
  30. methods: {
  31. open() {
  32. this.show = true
  33. },
  34. },
  35. }
  36. </script>
  37. <style scoped lang="scss">
  38. .simple-video-player {
  39. .pupup-content {
  40. width: 100vw;
  41. background: #000;
  42. }
  43. .video {
  44. margin: 0 auto;
  45. height: 100vh;
  46. }
  47. }
  48. </style>