删除aplayer中的部分废弃属性

This commit is contained in:
灌糖包子 2023-01-18 19:59:01 +08:00
parent 134dc41848
commit 5d3124519a
Signed by: sookie
GPG Key ID: 691E688C160D3188
4 changed files with 14 additions and 92 deletions

View File

@ -225,7 +225,7 @@ export default class Music extends BaseList<MusicPage> {
pic: `/api/v2/common/music/album/${item._id}`, pic: `/api/v2/common/music/album/${item._id}`,
} }
if(item.lyric_id) { if(item.lyric_id) {
musicItem.lrc = `${location.origin}/api/v1/common/music/lyric/${item.lyric_id}` musicItem.lrc = `${location.origin}/api/v2/common/music/lyric/${item.lyric_id}`
} }
return musicItem return musicItem
}) })

View File

@ -45,13 +45,13 @@
default: 0, default: 0,
}, },
theme: String, theme: String,
listmaxheight: String, listMaxHeight: String,
}, },
computed: { computed: {
listHeightStyle () { listHeightStyle () {
return { return {
height: `${33 * this.musicList.length - 1}px`, height: `${33 * this.musicList.length - 1}px`,
maxHeight: this.listmaxheight || '' maxHeight: this.listMaxHeight || ''
} }
} }
} }

View File

@ -50,10 +50,6 @@ export function warn (message) {
return console.warn(`[Vue-APlayer] ${message}`) return console.warn(`[Vue-APlayer] ${message}`)
} }
export function deprecatedProp (name, sinceVersion, alternative) {
return warn(`'${name}' is deprecated since v${sinceVersion}, and will be removed in future releases, use '${alternative}' instead`)
}
export function getElementViewLeft (element) { export function getElementViewLeft (element) {
let actualLeft = element.offsetLeft let actualLeft = element.offsetLeft
let current = element.offsetParent let current = element.offsetParent

View File

@ -2,9 +2,9 @@
<div <div
class="aplayer" class="aplayer"
:class="{ :class="{
'aplayer-narrow': isMiniMode, 'aplayer-narrow': mini,
'aplayer-withlist' : !isMiniMode && musicList.length > 0, 'aplayer-withlist' : !mini && musicList.length > 0,
'aplayer-withlrc': !isMiniMode && (!!$slots.display || shouldShowLrc), 'aplayer-withlrc': !mini && (!!$slots.display || showLrc),
'aplayer-float': isFloatMode, 'aplayer-float': isFloatMode,
'aplayer-loading': isPlaying && isLoading 'aplayer-loading': isPlaying && isLoading
}" }"
@ -20,13 +20,13 @@
@dragbegin="onDragBegin" @dragbegin="onDragBegin"
@dragging="onDragAround" @dragging="onDragAround"
/> />
<div class="aplayer-info" v-show="!isMiniMode"> <div class="aplayer-info" v-show="!mini">
<div class="aplayer-music"> <div class="aplayer-music">
<span class="aplayer-title">{{ currentMusic.title || 'Untitled' }}</span> <span class="aplayer-title">{{ currentMusic.title || 'Untitled' }}</span>
<span class="aplayer-author">{{ currentMusic.artist || currentMusic.author || 'Unknown' }}</span> <span class="aplayer-author">{{ currentMusic.artist || currentMusic.author || 'Unknown' }}</span>
</div> </div>
<slot name="display" :current-music="currentMusic" :play-stat="playStat"> <slot name="display" :current-music="currentMusic" :play-stat="playStat">
<lyrics :current-music="currentMusic" :play-stat="playStat" v-if="shouldShowLrc" /> <lyrics :current-music="currentMusic" :play-stat="playStat" v-if="showLrc && currentMusic.lrc" />
</slot> </slot>
<controls <controls
:shuffle="shouldShuffle" :shuffle="shouldShuffle"
@ -48,11 +48,11 @@
</div> </div>
<audio ref="audio"></audio> <audio ref="audio"></audio>
<music-list <music-list
:show="showList && !isMiniMode" :show="showList && !mini"
:current-music="currentMusic" :current-music="currentMusic"
:music-list="musicList" :music-list="musicList"
:play-index="playIndex" :play-index="playIndex"
:listmaxheight="listmaxheight || listMaxHeight" :listMaxHeight="listMaxHeight"
:theme="currentTheme" :theme="currentTheme"
@selectsong="onSelectSong" @selectsong="onSelectSong"
/> />
@ -63,7 +63,7 @@
import MusicList from './components/aplayer-list.vue' import MusicList from './components/aplayer-list.vue'
import Controls from './components/aplayer-controller.vue' import Controls from './components/aplayer-controller.vue'
import Lyrics from './components/aplayer-lrc.vue' import Lyrics from './components/aplayer-lrc.vue'
import { deprecatedProp, warn } from './utils' import { warn } from './utils'
/** /**
* memorize self-adapting theme for cover image urls * memorize self-adapting theme for cover image urls
@ -98,13 +98,7 @@
type: Object, type: Object,
required: true, required: true,
validator (song) { validator (song) {
if (song.url) { return song.src
deprecatedProp('music.url', '1.4.0', 'music.src')
}
if (song.author) {
deprecatedProp('music.author', '1.4.1', 'music.artist')
}
return song.src || song.url
}, },
}, },
list: { list: {
@ -220,62 +214,7 @@
repeat: { repeat: {
type: String, type: String,
default: REPEAT.NO_REPEAT, default: REPEAT.NO_REPEAT,
}, }
// deprecated props
/**
* @deprecated since 1.1.2, use listMaxHeight instead
*/
listmaxheight: {
type: String,
validator (value) {
if (value) {
deprecatedProp('listmaxheight', '1.1.2', 'listMaxHeight')
}
return true
},
},
/**
* @deprecated since 1.1.2, use mini instead
*/
narrow: {
type: Boolean,
default: false,
validator (value) {
if (value) {
deprecatedProp('narrow', '1.1.2', 'mini')
}
return true
},
},
/**
* @deprecated since 1.2.2
*/
showlrc: {
type: Boolean,
default: false,
validator (value) {
if (value) {
deprecatedProp('showlrc', '1.2.2', 'showLrc')
}
return true
},
},
/**
* @deprecated and REMOVED since 1.5.0
*/
// mode: {
// type: String,
// default: 'circulation',
// validator (value) {
// if (value) {
// deprecatedProp('mode', '1.5.0', 'shuffle and repeat')
// }
// return true
// }
// },
}, },
data () { data () {
return { return {
@ -343,14 +282,6 @@
this.internalMusic = val this.internalMusic = val
}, },
}, },
// compatible for deprecated props
isMiniMode () {
return this.mini || this.narrow
},
shouldShowLrc () {
return this.showLrc || this.showlrc
},
// props wrappers // props wrappers
currentTheme () { currentTheme () {
@ -368,8 +299,7 @@
}, },
shouldShowNativeControls () { shouldShowNativeControls () {
return process.env.NODE_ENV !== 'production' && return process.env.NODE_ENV !== 'production' &&
this.controls && this.controls && !this.mini
!this.isMiniMode
}, },
// useful // useful
@ -491,10 +421,6 @@
}) })
}, },
// controls
// play/pause
toggle () { toggle () {
if (!this.audio.paused) { if (!this.audio.paused) {
this.pause() this.pause()