mirror of
https://github.com/KevinMidboe/planetposen.git
synced 2025-10-29 17:50:32 +00:00
Uses prop "to" to send to edit from admin page.
This commit is contained in:
@@ -7,7 +7,9 @@
|
|||||||
</div>
|
</div>
|
||||||
<div v-if="products && products.length" class="products">
|
<div v-if="products && products.length" class="products">
|
||||||
<add-card />
|
<add-card />
|
||||||
<product-card v-for="product in products" :product="product" />
|
<product-card v-for="product in products"
|
||||||
|
:product="product"
|
||||||
|
:to="'/edit/' + product.urlSlug" :key="Math.random()" />
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<span v-else>
|
<span v-else>
|
||||||
|
|||||||
@@ -40,6 +40,10 @@ export default {
|
|||||||
product: {
|
product: {
|
||||||
type: Object,
|
type: Object,
|
||||||
required: true
|
required: true
|
||||||
|
},
|
||||||
|
to: {
|
||||||
|
type: String,
|
||||||
|
required: false
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
@@ -64,7 +68,7 @@ export default {
|
|||||||
store.dispatch('cartModule/addItemToCart', { ...this.product });
|
store.dispatch('cartModule/addItemToCart', { ...this.product });
|
||||||
},
|
},
|
||||||
viewProduct() {
|
viewProduct() {
|
||||||
this.$router.push('/shop/' + this.product.urlSlug)
|
this.$router.push(this.to ? this.to : '/shop/' + this.product.urlSlug)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user