diff --git a/package/text-clamp.vue b/package/text-clamp.vue index f41def6..a61028b 100644 --- a/package/text-clamp.vue +++ b/package/text-clamp.vue @@ -42,12 +42,14 @@ const props = withDefaults( location?: "start" | "middle" | "end"; ellipsis?: string; autoResize?: boolean; + html?: boolean; }>(), { expanded: false, location: "end", ellipsis: "…", autoResize: false, + html: false, } ); const emits = defineEmits<{ @@ -71,7 +73,7 @@ const realMaxHeight = computed(() => { }); const applyChange = () => { - textRef.value && (textRef.value.textContent = realText.value); + textRef.value && (props?.html ? textRef.value.innerHTML = realText.value : textRef.value.textContent = realText.value); }; const update = () => { if (state.localExpanded) return; diff --git a/src/App.vue b/src/App.vue index d36fa24..f7f77ab 100644 --- a/src/App.vue +++ b/src/App.vue @@ -334,6 +334,16 @@ import TextClamp from 'vue3-text-clamp'; false

+
  • +

    + html: boolean +

    +

    {{ t("props8") }}

    +

    + {{ t("default") }} + false +

    +