vodShort.vue 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  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. },
  49. methods:{
  50. start : function() {
  51. for(var i in this.$refs.video) {
  52. if (this.current_index == i) {
  53. this.$refs.video[this.current_index].start();
  54. } else {
  55. this.$refs.video[i].autoStart();
  56. }
  57. }
  58. },
  59. stop : function() {
  60. this.$refs.video[this.current_index].stop(true);
  61. },
  62. changeVod : function(e) {
  63. var self = this;
  64. self.$nextTick(()=>{
  65. this.$refs.video[this.current_index].stop(false);
  66. this.current_index = e.detail.current;
  67. self.start();
  68. });
  69. },
  70. },
  71. components:{
  72. deverVideo
  73. }
  74. }
  75. </script>
  76. <style>
  77. .swiper{
  78. width: 100vw;
  79. height: 100vh;
  80. /*position: fixed;*/
  81. position: relative;
  82. top: 0;
  83. left: 0;
  84. }
  85. </style>