删除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}`,
}
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
})

View File

@ -45,13 +45,13 @@
default: 0,
},
theme: String,
listmaxheight: String,
listMaxHeight: String,
},
computed: {
listHeightStyle () {
return {
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}`)
}
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) {
let actualLeft = element.offsetLeft
let current = element.offsetParent

View File

@ -2,9 +2,9 @@
<div
class="aplayer"
:class="{
'aplayer-narrow': isMiniMode,
'aplayer-withlist' : !isMiniMode && musicList.length > 0,
'aplayer-withlrc': !isMiniMode && (!!$slots.display || shouldShowLrc),
'aplayer-narrow': mini,
'aplayer-withlist' : !mini && musicList.length > 0,
'aplayer-withlrc': !mini && (!!$slots.display || showLrc),
'aplayer-float': isFloatMode,
'aplayer-loading': isPlaying && isLoading
}"
@ -20,13 +20,13 @@
@dragbegin="onDragBegin"
@dragging="onDragAround"
/>
<div class="aplayer-info" v-show="!isMiniMode">
<div class="aplayer-info" v-show="!mini">
<div class="aplayer-music">
<span class="aplayer-title">{{ currentMusic.title || 'Untitled' }}</span>
<span class="aplayer-author">{{ currentMusic.artist || currentMusic.author || 'Unknown' }}</span>
</div>
<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>
<controls
:shuffle="shouldShuffle"
@ -48,11 +48,11 @@
</div>
<audio ref="audio"></audio>
<music-list
:show="showList && !isMiniMode"
:show="showList && !mini"
:current-music="currentMusic"
:music-list="musicList"
:play-index="playIndex"
:listmaxheight="listmaxheight || listMaxHeight"
:listMaxHeight="listMaxHeight"
:theme="currentTheme"
@selectsong="onSelectSong"
/>
@ -63,7 +63,7 @@
import MusicList from './components/aplayer-list.vue'
import Controls from './components/aplayer-controller.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
@ -98,13 +98,7 @@
type: Object,
required: true,
validator (song) {
if (song.url) {
deprecatedProp('music.url', '1.4.0', 'music.src')
}
if (song.author) {
deprecatedProp('music.author', '1.4.1', 'music.artist')
}
return song.src || song.url
return song.src
},
},
list: {
@ -220,62 +214,7 @@
repeat: {
type: String,
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 () {
return {
@ -343,14 +282,6 @@
this.internalMusic = val
},
},
// compatible for deprecated props
isMiniMode () {
return this.mini || this.narrow
},
shouldShowLrc () {
return this.showLrc || this.showlrc
},
// props wrappers
currentTheme () {
@ -368,8 +299,7 @@
},
shouldShowNativeControls () {
return process.env.NODE_ENV !== 'production' &&
this.controls &&
!this.isMiniMode
this.controls && !this.mini
},
// useful
@ -491,10 +421,6 @@
})
},
// controls
// play/pause
toggle () {
if (!this.audio.paused) {
this.pause()