This commit is contained in:
bkfox
2024-04-30 22:27:05 +02:00
parent 202f31d169
commit 6b7cfbdadf
6 changed files with 10 additions and 6 deletions

View File

@ -16,7 +16,7 @@
</template>
<script>
export default {
emits: ['select', 'unselect', 'move'],
emits: ['select', 'unselect', 'move', 'remove'],
data() {
return {
selectedIndex: this.defaultIndex,
@ -50,11 +50,16 @@ export default {
findIndex(pred) { return this.set.findIndex(pred) },
remove(index, select=false) {
const item = this.set.get(index)
if(!item)
return
this.set.remove(index);
if(index < this.selectedIndex)
this.selectedIndex--;
if(select && this.selectedIndex == index)
this.select(index)
this.$emit('remove', {index, item, set: this.set})
},
select(index) {

View File

@ -274,7 +274,6 @@ export default {
if(event.type == 'ended' && (!this.playlist || this.playlist.selectNext() == -1))
this.play();
},
},
mounted() {

View File

@ -29,7 +29,7 @@ import ASoundItem from './ASoundItem';
export default {
extends: AList,
emits: [...AList.emits, 'remove'],
emits: [...AList.emits],
components: { ASoundItem },
props: {