精简部分播放器代码
This commit is contained in:
@@ -3,7 +3,7 @@
|
||||
class="aplayer"
|
||||
:class="{
|
||||
'aplayer-narrow': mini,
|
||||
'aplayer-withlist' : !mini && musicList.length > 0,
|
||||
'aplayer-withlist' : !mini && list.length > 0,
|
||||
'aplayer-withlrc': !mini && (!!$slots.display || showLrc),
|
||||
'aplayer-float': isFloatMode,
|
||||
'aplayer-loading': isPlaying && isLoading
|
||||
@@ -52,7 +52,7 @@
|
||||
<music-list
|
||||
:show="showList && !mini"
|
||||
:current-music="currentMusic"
|
||||
:music-list="musicList"
|
||||
:music-list="list"
|
||||
:play-index="playIndex"
|
||||
:listMaxHeight="listMaxHeight"
|
||||
:theme="currentTheme"
|
||||
@@ -146,7 +146,7 @@
|
||||
|
||||
// Audio attributes as props
|
||||
// since 1.4.0
|
||||
// autoplay controls muted preload volume
|
||||
// autoplay muted preload volume
|
||||
// autoplay is not observable
|
||||
|
||||
/**
|
||||
@@ -158,18 +158,6 @@
|
||||
default: false,
|
||||
},
|
||||
|
||||
/**
|
||||
* @since 1.4.0
|
||||
* whether to show native audio controls below Vue-APlayer
|
||||
* only work in development environment and not mini mode
|
||||
*
|
||||
* observable
|
||||
*/
|
||||
controls: {
|
||||
type: Boolean,
|
||||
default: false,
|
||||
},
|
||||
|
||||
/**
|
||||
* @since 1.4.0
|
||||
* observable, sync
|
||||
@@ -182,7 +170,10 @@
|
||||
* @since 1.4.0
|
||||
* observable
|
||||
*/
|
||||
preload: String,
|
||||
preload: {
|
||||
type: String,
|
||||
default: 'none'
|
||||
},
|
||||
|
||||
/**
|
||||
* @since 1.4.0
|
||||
@@ -266,6 +257,7 @@
|
||||
internalRepeat: this.repeat,
|
||||
// for shuffling
|
||||
shuffledList: [],
|
||||
hls: null
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
@@ -296,13 +288,6 @@
|
||||
if (this.isMobile) return false
|
||||
return this.autoplay
|
||||
},
|
||||
musicList () {
|
||||
return this.list
|
||||
},
|
||||
shouldShowNativeControls () {
|
||||
return process.env.NODE_ENV !== 'production' &&
|
||||
this.controls && !this.mini
|
||||
},
|
||||
|
||||
// useful
|
||||
|
||||
@@ -337,9 +322,6 @@
|
||||
this.currentMusic = this.shuffledList[val % this.shuffledList.length]
|
||||
},
|
||||
},
|
||||
shouldRepeat () {
|
||||
return this.repeatMode !== REPEAT.NO_REPEAT
|
||||
},
|
||||
|
||||
// since 1.4.0
|
||||
// sync muted, volume
|
||||
@@ -624,7 +606,6 @@
|
||||
|
||||
// since 1.4.0 Audio attributes as props
|
||||
|
||||
this.audio.controls = this.shouldShowNativeControls
|
||||
this.audio.muted = this.muted
|
||||
this.audio.preload = this.preload
|
||||
this.audio.volume = this.volume
|
||||
@@ -738,11 +719,7 @@
|
||||
},
|
||||
|
||||
// since 1.4.0
|
||||
// observe controls, muted, preload, volume
|
||||
|
||||
shouldShowNativeControls (val) {
|
||||
this.audio.controls = val
|
||||
},
|
||||
// observe muted, preload, volume
|
||||
isAudioMuted (val) {
|
||||
this.audio.muted = val
|
||||
},
|
||||
@@ -858,11 +835,6 @@
|
||||
}
|
||||
}
|
||||
|
||||
audio[controls] {
|
||||
display: block;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
// Mini mode
|
||||
&.aplayer-narrow {
|
||||
width: @aplayer-height;
|
||||
|
||||
Reference in New Issue
Block a user