You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

mixins.js 596B

12345678910111213141516171819202122232425262728293031
  1. const pidMixin = {
  2. props: {
  3. pid: {
  4. type: Number,
  5. required: true,
  6. validator: prop => typeof prop === 'number' || prop === null
  7. },
  8. }
  9. }
  10. const cardMixin = {
  11. data: () => ({
  12. cards: [],
  13. matches: [],
  14. loading: true,
  15. }),
  16. watch: {
  17. /** Fetch the queue if pid changes */
  18. pid() { this.getCards() },
  19. },
  20. async created() {
  21. await this.getCards()
  22. },
  23. methods: {
  24. _reformat(data, mapCb) {
  25. return data.map(mapCb)
  26. }
  27. }
  28. }
  29. export { pidMixin, cardMixin }