Skip to content

[tooltip + textarea] 按第一个按钮时抛出未处理异常 #6028

@RuijieYu

Description

@RuijieYu

tdesign-vue-next 版本

1.15.2

重现链接

No response

重现步骤

使用tdesign starter可复现。

以下两个文件并排,并在路由中挂载 component.vue 组件:

// textarea-component.vue
<template>
  <t-tooltip :content="textareaValue">
    <t-textarea v-model="textareaValue" autosize />
  </t-tooltip>
</template>
<script setup lang="ts">
import { computed, ref } from 'vue';

const props = defineProps<{
  modelValue: string;
}>();

const emit = defineEmits<{
  (e: 'update:modelValue', value: string): void;
}>();

const textareaValue = computed({
  get: () => props.modelValue,
  set: (val) => {
    emit('update:modelValue', val); // <--
  },
});
</script>
// textarea.vue
<template>
  <textarea-component v-model="text" />
</template>
<script setup lang="ts">
import { ref } from 'vue';

import textareaComponent from './textarea-component.vue';

const text = ref('');
</script>

期望结果

在textarea中可以正常打字,不抛异常

实际结果

chrome上连续抛出以下两个异常:

Uncaught (in promise) TypeError: Failed to execute 'getComputedStyle' on 'Window': parameter 1 is not of type 'Element'.
 at calculateNodeSize (helper.ts:244:24)
 at calcTextareaHeight (calcTextareaHeight.ts:40:7)
 at textarea.tsx:63:33

firefox上类似,不过只抛了一次。

框架版本

vue 3.5.18

浏览器版本

chrome 140.0.3485.54 / firefox 142.0.1

系统版本

windows

Node版本

24.3.0

补充说明

以上是最小复现用例。复现时发现以下元素缺少任意一项,问题不再复现:

  1. textareaValue的读操作包含emit
  2. textareaValue挂载成tooltip的content
  3. textareaValue挂载成textarea的v-model
  4. textarea开启autosize,boolean或结构体形式都会抛异常

IssueShoot

  • 预估时长: 3
  • 期望完成时间: 2025-10-07 00:00:00 +0000 UTC
  • 开发难度: 中
  • 参与人数: 1
  • 需求对接人: ivringpeng
  • 验收标准: 实现期望改造效果,提 PR 并通过验收无误
  • 备注: 最终激励以实际提交 pull request 并合并为准

Metadata

Metadata

Assignees

No one assigned

    Labels

    issueShoot上架到腾讯内部issueshoot平台的任务middle上架到腾讯内部issueshoot平台的任务 - 中等难度🐞 bugSomething isn't working

    Type

    No type

    Projects

    Status

    No status

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions