Skip to content

Commit 62144cb

Browse files
committed
better reactivity
1 parent eaac20e commit 62144cb

File tree

2 files changed

+12
-7
lines changed

2 files changed

+12
-7
lines changed

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "vue3-calendar-heatmap",
3-
"version": "1.0.7",
3+
"version": "1.0.8",
44
"description": "A lightweight calendar heatmap Vue 3 component built on SVG, inspired by julienr114's vue-calendar-heatmap ans github's contribution calendar graph",
55
"keywords": [
66
"vue",

src/CalendarHeatmap.vue

+11-6
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@
7676

7777
<script lang="ts">
7878
import { defineComponent, onBeforeUnmount, onMounted, PropType, ref, toRefs, watch } from 'vue';
79-
import { Heatmap, CalendarItem, Locale, Month, Position, Value } from '@/Heatmap';
79+
import { CalendarItem, Heatmap, Locale, Month, Position, Value } from '@/Heatmap';
8080
import tippy, { createSingleton, CreateSingletonInstance, Instance } from 'tippy.js';
8181
import 'tippy.js/dist/tippy.css';
8282
import 'tippy.js/dist/svg-arrow.css';
@@ -249,11 +249,16 @@
249249
}
250250
}
251251
252-
watch(toRefs(props).values, () => {
253-
heatmap.value = new Heatmap(props.endDate as Date, props.values, props.max);
254-
tippyInstances?.map(i => i.destroy());
255-
initTippy();
256-
});
252+
253+
const { values, tooltipUnit, tooltipFormatter, noDataText, max, rangeColor } = toRefs(props);
254+
watch(
255+
[ values, tooltipUnit, tooltipFormatter, noDataText, max, rangeColor ],
256+
() => {
257+
heatmap.value = new Heatmap(props.endDate as Date, props.values, props.max);
258+
tippyInstances?.map(i => i.destroy());
259+
initTippy();
260+
}
261+
);
257262
258263
onMounted(initTippy);
259264
onBeforeUnmount(() => {

0 commit comments

Comments
 (0)