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

[vue] v-once的使用场景有哪些? #459

Open
haizhilin2013 opened this issue Jun 22, 2019 · 7 comments
Open

[vue] v-once的使用场景有哪些? #459

haizhilin2013 opened this issue Jun 22, 2019 · 7 comments
Labels
vue vue

Comments

@haizhilin2013
Copy link
Collaborator

[vue] v-once的使用场景有哪些?

@haizhilin2013 haizhilin2013 added the vue vue label Jun 22, 2019
@ccllff
Copy link

ccllff commented Jul 4, 2019

单次触发的场景

@janwenGighub
Copy link

表单提交。可防止用户在请求未及时响应时,多次提交~

@sky124380729
Copy link

表单提交。可防止用户在请求未及时响应时,多次提交~

那假如触发了验证,验证失败了需要重新提交呢

@canwdev
Copy link

canwdev commented Mar 5, 2020

v-once 只渲染元素和组件一次。随后的重新渲染,元素/组件及其所有的子节点将被视为静态内容并跳过。这可以用于优化更新性能。

@AustinWen0530
Copy link

当页面需要显示一个元素的首次渲染的初始值以及在这之后变化后的值时,可以对首次渲染的标签使用v-once

{{msg}}

//msg不会改变

{{msg}}

@hyj443
Copy link

hyj443 commented Oct 20, 2021

只渲染一次,不会随着数据改变而改变
随后的重新渲染,元素/组件及其所有的子节点将被视为静态内容并跳过,可以优化更新性能。

@YJCCreateAHistory
Copy link

表单提交。可防止用户在请求未及时响应时,多次提交~

那假如触发了验证,验证失败了需要重新提交呢
可以在input失焦触发网络请求验证数据是否合格

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

No branches or pull requests

8 participants