Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Fix dom not change while data change #18

Open
@miyagipipi

Description

@miyagipipi

When my data object changes (such as the state of an item affecting a button color), I find that dom actually hasn't changed.
I analyzed the source code and found that the code shown below caused the dom rendering delay issue due to setTimeout.

index.vue line 313
watch( () => props.data, (newVal, oldVal) => { ... setTimeout(scrollRender, 0); } );

I changed this to directly runscrollRender() instead of runsetTimeout, and DOM promptly rendered the latest item state.

Why usesetTimeout here?
The code in the scrollRender function not needs to wait a period of time before running.

Because in otherwatch,scrollRender is directly called, and if it is necessary to perform certain tasks after updating the DOM, vuenextTick can also be used to replacesetTimeout.
If possible, I have a suggestion:

  1. ModifyscrollRender so that therenderEnd function for DOM operations is not placed in thescrollRender function.
  2. Inwatch part, directly runscrollRender() , and then callawait nextTick(renderEnd)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions


      [8]ページ先頭

      ©2009-2025 Movatter.jp