Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

textarea @input 事件内获取到的 v-model 的值是旧的值 #3211

Open
1 task done
mxue12138 opened this issue Jul 5, 2024 · 1 comment
Open
1 task done

textarea @input 事件内获取到的 v-model 的值是旧的值 #3211

mxue12138 opened this issue Jul 5, 2024 · 1 comment
Labels
💤 Inactive Inactive issues

Comments

@mxue12138
Copy link

mxue12138 commented Jul 5, 2024

Basic Info

Extra info

经过检查
input 的源代码是这样的

    updateValue(value);
    emit("input", value, e);

而 textarea 的事件是这样的

    emit("input", value, e);
    updateValue(value);

Steps to reproduce

打开控制台,在 input 和 textare 分别输入内容,input 输入内容和控制台输出的一样,而 textarea 输出的结果是上次的结果

@github-actions github-actions bot added the 💤 Inactive Inactive issues label Sep 21, 2024
@hunterMG
Copy link

遇到这个问题➕1, 暂时用下面的方法解决了:

  const reextractContent = async () => {
    await nextTick(); // 等待 DOM 更新
    console.log(textareaVal);
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
💤 Inactive Inactive issues
Projects
None yet
Development

No branches or pull requests

2 participants