Last active
January 3, 2018 13:15
-
-
Save jasperf/d290a2552ad8f8a2656dc531f3bceb49 to your computer and use it in GitHub Desktop.
new.vue for new products
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<template> | |
<product-form @save-product="addProduct" :model="model" :manufacturers="manufacturers"></product-form> | |
</template> | |
<script> | |
import ProductForm from '../../components/product/ProductForm.vue' | |
export default { | |
data() { | |
return { | |
model: {}, | |
}; | |
}, | |
created() { | |
this.$store.dispatch('allManufacturers'); | |
}, | |
computed: { | |
manufacturers() { | |
return this.$store.getters.allManufacturers; | |
}, | |
}, | |
methods: { | |
addProduct(model) { | |
console.log('model', model); | |
this.$store.dispatch('addProduct', model); | |
}, | |
}, | |
components: { | |
'product-form': ProductForm, | |
}, | |
}; | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment