|
@@ -1,7 +1,7 @@
|
|
|
<template lang="pug">
|
|
|
.product-card(@click="selectProduct({ data })")
|
|
|
h2.product-title {{ data.name }}
|
|
|
- img.product-image(:src="data.image_medium ? 'data:image/png;base64,' + data.image_medium : '/web/static/src/img/placeholder.png'")
|
|
|
+ img.product-image(:src="this.data.image_medium ? 'data:image/png;base64,' + this.data.image_medium : '/web/static/src/img/placeholder.png'")
|
|
|
.product-price
|
|
|
span Gs {{ data.list_price }}
|
|
|
.product-qty
|
|
@@ -19,9 +19,32 @@
|
|
|
}
|
|
|
}
|
|
|
},
|
|
|
- methods: mapActions([
|
|
|
- 'selectProduct'
|
|
|
- ])
|
|
|
+ computed: {
|
|
|
+ // FIXME
|
|
|
+ productImage() {
|
|
|
+ let img = new Image()
|
|
|
+ img.src = this.data.image_medium ? 'data:image/png;base64,' + this.data.image_medium : '/web/static/src/img/placeholder.png'
|
|
|
+ return img.src
|
|
|
+ }
|
|
|
+ },
|
|
|
+ methods: {
|
|
|
+ // TODO
|
|
|
+ drawImage() {
|
|
|
+ let ctx = this.$el.querySelector('.product-image').getContext('2d')
|
|
|
+ let img = new Image()
|
|
|
+ img.onload = () => {
|
|
|
+ ctx.drawImage(img, 0, 0, 80, 80)
|
|
|
+ }
|
|
|
+ console.log(this.data.image_medium)
|
|
|
+ img.src = this.data.image_medium ? 'data:image/png;base64,' + this.data.image_medium : '/web/static/src/img/placeholder.png'
|
|
|
+ },
|
|
|
+ ...mapActions([
|
|
|
+ 'selectProduct'
|
|
|
+ ])
|
|
|
+ },
|
|
|
+ mounted() {
|
|
|
+ // this.drawImage()
|
|
|
+ }
|
|
|
}
|
|
|
</script>
|
|
|
|