Преглед на файлове

[ADD] show image from base64 src

Gogs преди 7 години
родител
ревизия
6210fe6258
променени са 2 файла, в които са добавени 6 реда и са изтрити 5 реда
  1. 4 1
      src/components/CartItem.vue
  2. 2 4
      src/components/ProductCard.vue

+ 4 - 1
src/components/CartItem.vue

@@ -17,6 +17,9 @@
                     return {}
                 }
             }
+        },
+        mounted() {
+            console.log(this);
         }
     }
 </script>
@@ -40,7 +43,7 @@
             height: 30px
             margin-top: 6px
             text-align: right
-            float: left   
+            float: left
 
         .item-x
             width: 20px

+ 2 - 4
src/components/ProductCard.vue

@@ -1,7 +1,7 @@
 <template lang="pug">
     .product-card(@click="selectProduct({ data })")
         h2.product-title {{ data.name }}
-        img.product-image(src="/web/static/src/img/placeholder.png")
+        img.product-image(:src="data.image_medium ? 'data:image/png;base64,' + data.image_medium : '/web/static/src/img/placeholder.png'")
         .product-price
             span Gs {{ data.list_price }}
         .product-qty
@@ -33,7 +33,7 @@
         border: 1px solid #d3d3d3
         display: inline-block
         position: relative
-        
+
         &:hover
             cursor: pointer
 
@@ -69,5 +69,3 @@
             position: absolute
             bottom: 0
 </style>
-
-