Skip to content

Commit 7fb8efc

Browse files
authored
fix: should update when mount/unmount text component (vue-terminal#8)
1 parent 0c9a41f commit 7fb8efc

File tree

1 file changed

+8
-3
lines changed
  • packages/core/src/components

1 file changed

+8
-3
lines changed

packages/core/src/components/Text.ts

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,9 @@ import {
44
h,
55
inject,
66
defineComponent,
7+
onMounted,
78
onUpdated,
9+
onUnmounted,
810
} from '@vue/runtime-core'
911
import type { LiteralUnion } from '../utils'
1012
import type { Styles } from '../renderer/styles'
@@ -46,9 +48,12 @@ export const TuiText = defineComponent({
4648

4749
setup(props, { slots }) {
4850
const scheduleUpdate = inject(scheduleUpdateSymbol)!
49-
onUpdated(() => {
50-
scheduleUpdate()
51-
})
51+
52+
onMounted(scheduleUpdate)
53+
54+
onUpdated(scheduleUpdate)
55+
56+
onUnmounted(scheduleUpdate)
5257

5358
function transform(text: string): string {
5459
if (props.dimmed) {

0 commit comments

Comments
 (0)