Skip to content

Commit

Permalink
fix example
Browse files Browse the repository at this point in the history
  • Loading branch information
MrWangJustToDo committed Feb 27, 2024
1 parent a848e6c commit 0dd287a
Show file tree
Hide file tree
Showing 5 changed files with 149 additions and 302 deletions.
4 changes: 2 additions & 2 deletions packages/vue/src/hooks/useTextWidth.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { ref, watchPostEffect } from "vue";

import { useIsMounted } from "./useIsMounted";

import type { Ref} from "vue";
import type { Ref } from "vue";

let canvasCtx: CanvasRenderingContext2D | null = null;

Expand Down Expand Up @@ -52,7 +52,7 @@ export const useTextWidth = ({

const measureText = () => {
if (!isMounted.value) return;
width.value = measureInstance.measure(text.value, font.value);
width.value = measureInstance.measure(text.value || "", font.value);
};

watchPostEffect(measureText);
Expand Down
Loading

0 comments on commit 0dd287a

Please sign in to comment.