audioList.vue 1.4 KB

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