Prechádzať zdrojové kódy

[ADD] modal component for variant selection

Gogs 7 rokov pred
rodič
commit
a1476b93a5

+ 1 - 0
package.json

@@ -28,6 +28,7 @@
 	"dependencies": {
 		"vue": "^2.4.1",
 		"vue-form-wizard": "^0.6.1",
+		"vue-js-modal": "^1.2.6",
 		"vuex": "^2.3.1"
 	}
 }

+ 1 - 0
src/components/ProductCard.vue

@@ -44,6 +44,7 @@
         },
         mounted() {
             // this.drawImage()
+            // console.log(this)
         }
     }
 </script>

+ 8 - 5
src/components/ProductsGrid.vue

@@ -2,22 +2,25 @@
     .products-grid
         template(v-for="product in products")
             product-card(:data="product")
+        modal(name="product-selector")
 </template>
 
 <script>
     import ProductCard from '@/components/ProductCard'
-    import { mapGetters, mapActions } from 'vuex'
+    import VModal from 'vue-js-modal'
+    import { mapGetters } from 'vuex'
 
     export default {
         components: {
-            'product-card': ProductCard
+            'product-card': ProductCard,
+            'product-modal': VModal
         },
         computed: mapGetters({
             products: 'getProducts'
         }),
-        methods: mapActions([
-            'selectProduct'
-        ]),
+        mounted() {
+            this.$modal.show('product-selector')
+        }
     }
 </script>
 

+ 3 - 0
src/index.js

@@ -1,7 +1,10 @@
 import Vue from 'vue'
 import App from '@/App'
+import VModal from 'vue-js-modal'
 import store from '@/store'
 
+Vue.use(VModal)
+
 Vue.config.productionTip = false
 Vue.config.silent = true
 

+ 5 - 2
src/store/actions.js

@@ -1,5 +1,8 @@
 const actions = {
-    getData({ commit }) {
-
+    getData({ dispatch }) {
+        dispatch('fetchCompany')
+        dispatch('fetchCurrencies')
+        dispatch('fetchProducts')
+        dispatch('fetchCustomers')
     }
 }

+ 4 - 0
yarn.lock

@@ -3920,6 +3920,10 @@ vue-hot-reload-api@^2.1.0:
   version "2.1.0"
   resolved "https://registry.yarnpkg.com/vue-hot-reload-api/-/vue-hot-reload-api-2.1.0.tgz#9ca58a6e0df9078554ce1708688b6578754d86de"
 
+vue-js-modal@^1.2.6:
+  version "1.2.6"
+  resolved "https://registry.yarnpkg.com/vue-js-modal/-/vue-js-modal-1.2.6.tgz#1697b366f4aaac56bf499e678f4bc1d1dd9722fe"
+
 vue-loader@^12.2.2:
   version "12.2.2"
   resolved "https://registry.yarnpkg.com/vue-loader/-/vue-loader-12.2.2.tgz#2b3a764f27018f975bc78cb8b1f55137548ee2d7"