vodShort.vue 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  1. <template name="vodShort">
  2. <view>
  3. <swiper class="swiper" autoplay="false" vertical="true" interval="990000" @change="changeVod" circular="true">
  4. <swiper-item v-for="(v, k) in item" :key="k">
  5. <dever-video
  6. :src="v.video"
  7. :pic="v.pic"
  8. :index="k"
  9. :vid="v.id"
  10. :type="v.type"
  11. :disabled="false"
  12. :position_item="v.text"
  13. :position_save="v.is_button"
  14. :load.sync="load"
  15. ref="video"
  16. >
  17. </dever-video>
  18. </swiper-item>
  19. </swiper>
  20. </view>
  21. </template>
  22. <script>
  23. import deverVideo from '@/lib/dever/components/video.nvue';
  24. var play = true;
  25. export default {
  26. name: "vodShort",
  27. props: {
  28. control : {
  29. type : Object,
  30. value : null
  31. },
  32. item : {
  33. type : Array,
  34. value : null
  35. },
  36. index : 0
  37. },
  38. data() {
  39. return {
  40. load : false,
  41. current_index: 0,
  42. };
  43. },
  44. created() {
  45. },
  46. mounted() {
  47. this.control[this.index] = this;
  48. for(var i in this.$refs.video) {
  49. this.$refs.video[i].autoStart();
  50. }
  51. },
  52. methods:{
  53. start : function() {
  54. if (this.Dever.source == 'h5' && uni.getSystemInfoSync().platform == 'ios') {
  55. return;
  56. }
  57. for(var i in this.$refs.video) {
  58. if (this.current_index == i) {
  59. this.$refs.video[this.current_index].start();
  60. }
  61. }
  62. },
  63. stop : function() {
  64. this.$refs.video[this.current_index].stop(true);
  65. },
  66. changeVod : function(e) {
  67. var self = this;
  68. self.$nextTick(()=>{
  69. this.$refs.video[this.current_index].stop(false);
  70. this.current_index = e.detail.current;
  71. self.start();
  72. });
  73. },
  74. },
  75. components:{
  76. deverVideo
  77. }
  78. }
  79. </script>
  80. <style>
  81. .swiper{
  82. width: 100vw;
  83. height: 100vh;
  84. /*position: fixed;*/
  85. position: relative;
  86. top: 0;
  87. left: 0;
  88. }
  89. </style>