vodShort.vue 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116
  1. <template name="vodShort">
  2. <view>
  3. <swiper class="swiper" :circular="circular" :vertical="vertical" @change="changeVod">
  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. <!--dever-swiper class="swiper" :circular="circular" :vertical="vertical" :item="item" v-slot="{k,v}" @change="changeVod">
  21. <dever-video
  22. :src="v.video"
  23. :pic="v.pic"
  24. :index="k"
  25. :vid="v.id"
  26. :type="v.type"
  27. :disabled="false"
  28. :position_item="v.text"
  29. :position_save="v.is_button"
  30. :load.sync="load"
  31. ref="video"
  32. >
  33. </dever-video>
  34. </dever-swiper-->
  35. </view>
  36. </template>
  37. <script>
  38. import deverVideo from '@/lib/dever/components/video.nvue';
  39. import deverSwiper from '@/lib/dever/components/swiper.vue';
  40. var play = true;
  41. export default {
  42. name: "vodShort",
  43. props: {
  44. control : {
  45. type : Object,
  46. defalut : {}
  47. },
  48. item : {
  49. type : Array,
  50. defalut : {}
  51. },
  52. index : {
  53. type : Number,
  54. default : 0
  55. },
  56. },
  57. data() {
  58. return {
  59. circular : true,
  60. vertical : true,
  61. load : false,
  62. current_index: 0,
  63. };
  64. },
  65. created() {
  66. },
  67. mounted() {
  68. this.control[this.index] = this;
  69. for(var i in this.$refs.video) {
  70. this.$refs.video[i].autoStart();
  71. }
  72. },
  73. methods:{
  74. start : function() {
  75. if (this.Dever.source == 'h5' && uni.getSystemInfoSync().platform == 'ios') {
  76. return;
  77. }
  78. for(var i in this.$refs.video) {
  79. if (this.current_index == i) {
  80. this.$refs.video[this.current_index].start();
  81. }
  82. }
  83. },
  84. stop : function() {
  85. this.$refs.video[this.current_index].stop(true);
  86. },
  87. changeVod : function(e) {
  88. var self = this;
  89. self.$nextTick(()=>{
  90. this.$refs.video[this.current_index].stop(false);
  91. this.current_index = e.detail.current;
  92. self.start();
  93. });
  94. },
  95. },
  96. components:{
  97. deverVideo,deverSwiper
  98. }
  99. }
  100. </script>
  101. <style>
  102. .swiper{
  103. width: 100vw;
  104. height: 100vh;
  105. /*position: fixed;*/
  106. position: relative;
  107. top: 0;
  108. left: 0;
  109. }
  110. </style>