浏览代码

fix: tooltip

Timothy J. Baek 1 年之前
父节点
当前提交
f9482275f2
共有 1 个文件被更改,包括 8 次插入7 次删除
  1. 8 7
      src/lib/components/common/Tooltip.svelte

+ 8 - 7
src/lib/components/common/Tooltip.svelte

@@ -10,18 +10,19 @@
 
 
 	$: if (tooltipElement && content) {
 	$: if (tooltipElement && content) {
 		if (tooltipInstance) {
 		if (tooltipInstance) {
-			tooltipInstance[0]?.destroy();
+			tooltipInstance.setContent(content);
+		} else {
+			tooltipInstance = tippy(tooltipElement, {
+				content: content,
+				placement: placement,
+				allowHTML: true
+			});
 		}
 		}
-		tooltipInstance = tippy(tooltipElement, {
-			content: content,
-			placement: placement,
-			allowHTML: true
-		});
 	}
 	}
 
 
 	onDestroy(() => {
 	onDestroy(() => {
 		if (tooltipInstance) {
 		if (tooltipInstance) {
-			tooltipInstance[0]?.destroy();
+			tooltipInstance.destroy();
 		}
 		}
 	});
 	});
 </script>
 </script>