player
This commit is contained in:
		@ -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) {
 | 
			
		||||
 | 
			
		||||
@ -274,7 +274,6 @@ export default {
 | 
			
		||||
            if(event.type == 'ended' && (!this.playlist || this.playlist.selectNext() == -1))
 | 
			
		||||
                this.play();
 | 
			
		||||
        },
 | 
			
		||||
 | 
			
		||||
    },
 | 
			
		||||
 | 
			
		||||
    mounted() {
 | 
			
		||||
 | 
			
		||||
@ -29,7 +29,7 @@ import ASoundItem from './ASoundItem';
 | 
			
		||||
 | 
			
		||||
export default {
 | 
			
		||||
    extends: AList,
 | 
			
		||||
    emits: [...AList.emits, 'remove'],
 | 
			
		||||
    emits: [...AList.emits],
 | 
			
		||||
    components: { ASoundItem },
 | 
			
		||||
 | 
			
		||||
    props: {
 | 
			
		||||
 | 
			
		||||
		Reference in New Issue
	
	Block a user