Created
July 12, 2016 16:21
-
-
Save codehz/266db4303fe087bfdc8b63908ce830e8 to your computer and use it in GitHub Desktop.
Action delete, moveUp and moveDown
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
playListAction({action, index}) { | |
switch (action) { | |
case 'delete': | |
this.playList.splice(index, 1); | |
break; | |
case 'moveUp': | |
this.playList.splice((index - 1 + this.playList.length) % this.playList.length, 0, this.playList.splice(index, 0)); | |
break; | |
case 'moveDown': | |
this.playList.splice((index + 1) % this.playList.length, 0, this.playList.splice(index, 0)); | |
break; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment