vue.mdx 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. ---
  2. slug: /vue
  3. ---
  4. import Tabs from '@theme/Tabs';
  5. import TabItem from '@theme/TabItem';
  6. # Vue
  7. [Vue][] components for the Uppy UI plugins.
  8. ## Install
  9. <Tabs>
  10. <TabItem value="npm" label="NPM" default>
  11. ```shell
  12. npm install @uppy/vue
  13. ```
  14. </TabItem>
  15. <TabItem value="yarn" label="Yarn">
  16. ```shell
  17. yarn add @uppy/vue
  18. ```
  19. </TabItem>
  20. </Tabs>
  21. :::note
  22. You also need to install the UI plugin you want to use. For instance,
  23. `@uppy/dashboard`.
  24. :::
  25. ## Use
  26. The following plugins are available as Vue component wrappers:
  27. - `<Dashboard />` renders [`@uppy/dashboard`](/docs/dashboard) inline
  28. - `<DashboardModal />` renders [`@uppy/dashboard`](/docs/dashboard) as a modal
  29. - `<DragDrop />` renders [`@uppy/drag-drop`](/docs/drag-drop)
  30. - `<ProgressBar />` renders [`@uppy/progress-bar`](/docs/progress-bar)
  31. - `<StatusBar />` renders [`@uppy/status-bar`](/docs/status-bar)
  32. Instead of adding a UI plugin to an Uppy instance with `.use()`, the Uppy
  33. instance can be passed into components as an `uppy` prop. Due to the way Vue
  34. handles reactivity, you can initialize Uppy the same way you would with vanilla
  35. JavaScript.
  36. ```html
  37. <script>
  38. import { Dashboard } from '@uppy/vue';
  39. import Uppy from '@uppy/core';
  40. import Webcam from '@uppy/webcam';
  41. // Don't forget the CSS: core and UI components + plugins you are using
  42. import '@uppy/core/dist/style.css';
  43. import '@uppy/dashboard/dist/style.css';
  44. import '@uppy/webcam/dist/style.css';
  45. const uppy = new Uppy().use(Webcam);
  46. </script>
  47. <template>
  48. <Dashboard :uppy="uppy" :plugins="['Webcam']" />
  49. </template>
  50. ```
  51. [vue]: https://vuejs.org