vodShort.vue 1.8 KB

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