123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121 |
- <template name="audioList">
- <view>
- <swiper class="swiper" autoplay="false" vertical="true" interval="990000" @change="changeAudio" :current="current_index" :circular="circular">
- <swiper-item v-for="(v, k) in item" :key="k">
- <dever-audio
- :src="v.audio"
- :pic="v.pic"
- :lrc="v.lrc ? v.lrc : true"
- :title="v.name"
- :singer="v.singer"
- :lrc_color="v.color"
- :lrc_atcolor="v.atcolor"
- :control="true"
- :loop="true"
- :recycle="recycle"
- :load.sync="load"
- @setRecycle="setRecycle"
- @last="last"
- @next="next"
- ref="audio"
- >
- </dever-audio>
- </swiper-item>
- </swiper>
- </view>
- </template>
- <script>
- import deverAudio from '@/lib/dever/components/audio.nvue';
- var play = true;
- export default {
- name: "audioList",
- props: {
- control : {
- type : Object,
- value : null
- },
- item : {
- type : Array,
- value : null
- },
- index : 0
- },
- data() {
- return {
- recycle : true,
- circular : true,
- load : false,
- current_index: 0,
- total : 0,
- };
- },
- created() {
-
- },
- mounted() {
- this.control[this.index] = this;
- this.total = this.$refs.audio.length - 1;
- },
- methods:{
- start : function() {
- this.$refs.audio[this.current_index].start();
- },
- stop : function() {
- this.$refs.audio[this.current_index].stop(true);
- },
- changeAudio : function(e) {
- this.change(e.detail.current);
- },
- change : function(index) {
- var self = this;
- self.$nextTick(()=>{
- this.$refs.audio[this.current_index].stop(false);
- this.current_index = index;
- setTimeout(function() {
- self.start();
- }, 200);
- });
- },
- next : function() {
- var current_index = this.current_index;
- if (current_index >= this.total) {
- current_index = 0;
- } else {
- current_index = current_index + 1;
- }
- this.change(current_index);
- },
-
- last : function() {
- var current_index = this.current_index;
- if (current_index == 0) {
- current_index = this.total;
- } else {
- current_index = current_index - 1;
- }
- this.change(current_index);
- },
-
- setRecycle : function() {
- this.recycle = !this.recycle;
- return this.recycle;
- }
- },
- components:{
- deverAudio
- }
- }
- </script>
- <style>
- .swiper{
- width: 100vw;
- height: 100vh;
- /*position: fixed;*/
- position: relative;
- top: 0;
- left: 0;
- }
- </style>
|