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.

Dialog.vue 2.6KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108
  1. <template>
  2. <v-dialog
  3. v-model="dialog"
  4. width="400px"
  5. >
  6. <v-card>
  7. <v-card-title class="grey darken-2">
  8. Add Item
  9. </v-card-title>
  10. <v-container>
  11. <v-row class="mx-2">
  12. <v-col
  13. class="align-center justify-space-between"
  14. cols="12"
  15. >
  16. <v-row
  17. align="center"
  18. class="mr-0"
  19. >
  20. </v-row>
  21. </v-col>
  22. <v-col cols="12">
  23. <v-text-field
  24. v-model="title"
  25. prepend-icon="mdi-pizza"
  26. placeholder="Item"
  27. ></v-text-field>
  28. </v-col>
  29. <v-col cols="12">
  30. <v-text-field
  31. v-model="amount"
  32. prepend-icon="mdi-hamburger"
  33. placeholder="Amount"
  34. ></v-text-field>
  35. </v-col>
  36. <v-col cols="12">
  37. <v-text-field
  38. v-model="src"
  39. prepend-icon="mdi-image"
  40. placeholder="Image"
  41. ></v-text-field>
  42. </v-col>
  43. </v-row>
  44. </v-container>
  45. <v-card-actions align="center">
  46. <v-spacer></v-spacer>
  47. <v-btn
  48. x-large
  49. color="error"
  50. @click="cancel"
  51. >Cancel</v-btn>
  52. <v-btn
  53. x-large
  54. color="primary"
  55. @click="addItem"
  56. >Add</v-btn>
  57. </v-card-actions>
  58. </v-card>
  59. </v-dialog>
  60. </template>
  61. <script>
  62. export default {
  63. name: 'Dialog',
  64. computed: {
  65. dialog () {
  66. return this.$store.state.dialog
  67. }
  68. },
  69. data: () => ({
  70. src: '',
  71. title: '',
  72. amount: '',
  73. // count: this.$store.state.count,
  74. // items: store.state.items,
  75. // items: [
  76. // {
  77. // color: '#1F7087',
  78. // src: 'https://cdn.vuetifyjs.com/images/cards/foster.jpg',
  79. // title: 'Supermodel',
  80. // artist: 'Foster the People',
  81. // },
  82. // {
  83. // color: '#952175',
  84. // src: 'https://cdn.vuetifyjs.com/images/cards/halcyon.png',
  85. // title: 'Halcyon Days',
  86. // artist: 'Ellie Goulding',
  87. // },
  88. // ],
  89. }),
  90. methods: {
  91. addItem() {
  92. var item = {
  93. src: this.src,
  94. title: this.title,
  95. amount: this.amount,
  96. }
  97. this.$store.commit('appendItem', item)
  98. },
  99. cancel() {
  100. this.$store.state.dialog = false
  101. }
  102. }
  103. }
  104. </script>