Create.vue 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. <template>
  2. <div class='modal is-active'>
  3. <div class='modal-background'></div>
  4. <div class='modal-card'>
  5. <header class='modal-card-head'>
  6. <p class='modal-card-title'>Create Playlist</p>
  7. <button class='delete' @click='$parent.toggleModal("createPlaylist")'></button>
  8. </header>
  9. <section class='modal-card-body'>
  10. <p class='control is-expanded'>
  11. <input class='input' type='text' placeholder='Playlist Display Name' v-model='playlist.displayName'>
  12. </p>
  13. </section>
  14. <footer class='modal-card-foot'>
  15. <a class='button is-info' @click='createPlaylist()'>Create Playlist</a>
  16. </footer>
  17. </div>
  18. </div>
  19. </template>
  20. <script>
  21. import { Toast } from 'vue-roaster';
  22. export default {
  23. data() {
  24. return {
  25. playlist: {
  26. displayName: null,
  27. songs: [],
  28. createdBy: this.$parent.$parent.username,
  29. createdAt: Date.now()
  30. }
  31. }
  32. },
  33. methods: {
  34. createPlaylist: function () {
  35. let _this = this;
  36. _this.socket.emit('playlists.create', _this.playlist, res => {
  37. Toast.methods.addToast(res.message, 3000);
  38. });
  39. this.$parent.toggleModal('createPlaylist');
  40. }
  41. },
  42. ready: function () {
  43. let _this = this;
  44. let socketInterval = setInterval(() => {
  45. if (!!_this.$parent.$parent.socket) {
  46. _this.socket = _this.$parent.$parent.socket;
  47. clearInterval(socketInterval);
  48. }
  49. }, 100);
  50. }
  51. }
  52. </script>
  53. <style type='scss' scoped>
  54. .menu { padding: 0 20px; }
  55. .menu-list li {
  56. display: flex;
  57. justify-content: space-between;
  58. }
  59. .menu-list a:hover { color: #000 !important; }
  60. li a {
  61. display: flex;
  62. align-items: center;
  63. }
  64. .controls {
  65. display: flex;
  66. a {
  67. display: flex;
  68. align-items: center;
  69. }
  70. }
  71. .table {
  72. margin-bottom: 0;
  73. }
  74. h5 { padding: 20px 0; }
  75. </style>