App.vue 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104
  1. <template>
  2. <div id="app">
  3. <!-- <HelloWorld msg="Welcome to Uppy Vue Demo"/> -->
  4. <h1>Welcome to Uppy Vue Demo!</h1>
  5. <h2>Inline Dashboard</h2>
  6. <label>
  7. <input
  8. type="checkbox"
  9. :checked="showInlineDashboard"
  10. @change="(event) => {
  11. showInlineDashboard = event.target.checked
  12. }"
  13. />
  14. Show Dashboard
  15. </label>
  16. <dashboard
  17. v-if="showInlineDashboard"
  18. :uppy="uppy"
  19. :props="{
  20. metaFields: [{ id: 'name', name: 'Name', placeholder: 'File name' }]
  21. }"
  22. />
  23. <h2>Modal Dashboard</h2>
  24. <div>
  25. <button @click="open = true">Show Dashboard</button>
  26. <dashboard-modal
  27. :uppy="uppy2"
  28. :open="open"
  29. :props="{
  30. onRequestCloseModal: handleClose
  31. }"
  32. />
  33. </div>
  34. <h2>Drag Drop Area</h2>
  35. <drag-drop
  36. :uppy="uppy"
  37. :props="{
  38. locale: {
  39. strings: {
  40. chooseFile: 'Boop a file',
  41. orDragDrop: 'or yoink it here'
  42. }
  43. }
  44. }"
  45. />
  46. <h2>Progress Bar</h2>
  47. <progress-bar
  48. :uppy="uppy"
  49. :props="{
  50. hideAfterFinish: false
  51. }"
  52. />
  53. </div>
  54. </template>
  55. <script>
  56. import Uppy from '@uppy/core'
  57. // import Tus from '@uppy/tus'
  58. import { Dashboard, DashboardModal, DragDrop, ProgressBar } from '@uppy/vue'
  59. export default {
  60. name: 'App',
  61. components: {
  62. Dashboard,
  63. DashboardModal,
  64. DragDrop,
  65. ProgressBar
  66. },
  67. computed: {
  68. uppy: () => new Uppy({ id: 'uppy1', autoProceed: true, debug: true }),
  69. // .use(Tus, { endpoint: 'https://tusd.tusdemo.net/files/' }),
  70. uppy2: () => new Uppy({ id: 'uppy2', autoProceed: false, debug: true })
  71. // .use(Tus, { endpoint: 'https://tusd.tusdemo.net/files/' }),
  72. },
  73. data () {
  74. return {
  75. open: false,
  76. showInlineDashboard: false
  77. }
  78. },
  79. methods: {
  80. handleClose() { this.open = false }
  81. },
  82. }
  83. </script>
  84. <style src='@uppy/core/dist/style.css'></style>
  85. <style src='@uppy/dashboard/dist/style.css'></style>
  86. <style src='@uppy/drag-drop/dist/style.css'></style>
  87. <style src='@uppy/progress-bar/dist/style.css'></style>
  88. <style>
  89. #app {
  90. font-family: Avenir, Helvetica, Arial, sans-serif;
  91. -webkit-font-smoothing: antialiased;
  92. -moz-osx-font-smoothing: grayscale;
  93. text-align: center;
  94. color: #2c3e50;
  95. margin-top: 60px;
  96. }
  97. </style>