|
@@ -1,5 +1,5 @@
|
|
|
<template>
|
|
<template>
|
|
|
- <div ref="mapRef" id="mapRef" :style="{ display: 'flex', color: props.shop.bgColor }">
|
|
|
|
|
|
|
+ <div ref="mapRef" id="mapRef" :style="{ display: 'flex', color: shop.bgColor }">
|
|
|
<svg width="32px" height="39px" fill="currentColor" xmlns="http://www.w3.org/2000/svg">
|
|
<svg width="32px" height="39px" fill="currentColor" xmlns="http://www.w3.org/2000/svg">
|
|
|
<defs>
|
|
<defs>
|
|
|
<linearGradient x1="84.362%" y1="100%" x2="15.638%" y2="0%" id="prefix__a">
|
|
<linearGradient x1="84.362%" y1="100%" x2="15.638%" y2="0%" id="prefix__a">
|
|
@@ -88,11 +88,8 @@
|
|
|
/>
|
|
/>
|
|
|
</g>
|
|
</g>
|
|
|
</svg>
|
|
</svg>
|
|
|
- <span
|
|
|
|
|
- class="text-block"
|
|
|
|
|
- :style="{ fontSize: props.shop.fontSize, color: props.shop.fontColor }"
|
|
|
|
|
- >
|
|
|
|
|
- {{ props.shop.name }}
|
|
|
|
|
|
|
+ <span class="text-block" :style="{ fontSize: shop.fontSize, color: shop.fontColor }">
|
|
|
|
|
+ {{ shop.name }}
|
|
|
</span>
|
|
</span>
|
|
|
</div>
|
|
</div>
|
|
|
</div>
|
|
</div>
|
|
@@ -103,13 +100,15 @@
|
|
|
import html2canvas from 'html2canvas';
|
|
import html2canvas from 'html2canvas';
|
|
|
import { MapWorkShopInfoItem } from '../../stores/useMapEditor';
|
|
import { MapWorkShopInfoItem } from '../../stores/useMapEditor';
|
|
|
|
|
|
|
|
- const props = defineProps<{ shop: MapWorkShopInfoItem; getSvg: (url: string) => void }>();
|
|
|
|
|
|
|
+ // const props = defineProps<{ shop: MapWorkShopInfoItem; getSvg?: (url: string) => void }>();
|
|
|
|
|
+
|
|
|
|
|
+ const shop = ref<MapWorkShopInfoItem>({} as MapWorkShopInfoItem);
|
|
|
|
|
|
|
|
const mapRef = ref<HTMLDivElement>();
|
|
const mapRef = ref<HTMLDivElement>();
|
|
|
const img = ref('');
|
|
const img = ref('');
|
|
|
|
|
|
|
|
- onMounted(() => {
|
|
|
|
|
- html2canvas(mapRef.value!, {
|
|
|
|
|
|
|
+ const getImages = () => {
|
|
|
|
|
+ return html2canvas(mapRef.value!, {
|
|
|
width: 213,
|
|
width: 213,
|
|
|
height: 44,
|
|
height: 44,
|
|
|
useCORS: true,
|
|
useCORS: true,
|
|
@@ -117,9 +116,38 @@
|
|
|
backgroundColor: 'transparent',
|
|
backgroundColor: 'transparent',
|
|
|
}).then((canvas) => {
|
|
}).then((canvas) => {
|
|
|
img.value = canvas.toDataURL('images/jpg');
|
|
img.value = canvas.toDataURL('images/jpg');
|
|
|
- props.getSvg(img.value);
|
|
|
|
|
|
|
+ return canvas.toDataURL('images/jpg');
|
|
|
});
|
|
});
|
|
|
|
|
+ };
|
|
|
|
|
+
|
|
|
|
|
+ const setShop = (data: MapWorkShopInfoItem) => {
|
|
|
|
|
+ // shop.value = data;
|
|
|
|
|
+ return html2canvas(mapRef.value!, {
|
|
|
|
|
+ width: 213,
|
|
|
|
|
+ height: 44,
|
|
|
|
|
+ useCORS: true,
|
|
|
|
|
+ allowTaint: true,
|
|
|
|
|
+ backgroundColor: 'transparent',
|
|
|
|
|
+ }).then((canvas) => {
|
|
|
|
|
+ img.value = canvas.toDataURL('images/jpg');
|
|
|
|
|
+ return canvas.toDataURL('images/jpg');
|
|
|
|
|
+ });
|
|
|
|
|
+ };
|
|
|
|
|
+
|
|
|
|
|
+ onMounted(() => {
|
|
|
|
|
+ // html2canvas(mapRef.value!, {
|
|
|
|
|
+ // width: 213,
|
|
|
|
|
+ // height: 44,
|
|
|
|
|
+ // useCORS: true,
|
|
|
|
|
+ // allowTaint: true,
|
|
|
|
|
+ // backgroundColor: 'transparent',
|
|
|
|
|
+ // }).then((canvas) => {
|
|
|
|
|
+ // img.value = canvas.toDataURL('images/jpg');
|
|
|
|
|
+ // props.getSvg && props.getSvg(img.value);
|
|
|
|
|
+ // });
|
|
|
});
|
|
});
|
|
|
|
|
+
|
|
|
|
|
+ defineExpose({ getImages, setShop });
|
|
|
</script>
|
|
</script>
|
|
|
|
|
|
|
|
<style scoped>
|
|
<style scoped>
|