Skip to content

Instantly share code, notes, and snippets.

@jasperf
Last active January 3, 2018 13:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jasperf/d290a2552ad8f8a2656dc531f3bceb49 to your computer and use it in GitHub Desktop.
Save jasperf/d290a2552ad8f8a2656dc531f3bceb49 to your computer and use it in GitHub Desktop.
new.vue for new products
<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