Skip to content

when plain element with v-bind="obj" has style property, style property mutation is not work #11691

Open

Activity

jh-leong

jh-leong commented on Aug 23, 2024

@jh-leong
Member

As a workaround, you can reassign the style fields like this: Playground

// state.obj.style.color = 'yellow'
state.obj.style = {...state.obj.style, color: 'yellow'}

Or use a separate style binding: Playground

a42195472

a42195472 commented on Aug 23, 2024

@a42195472
Author

In the file of packages/runtime-core/src/vnode.ts, The guardReactiveProps function should use deep copy to handle reactive props?
If use a shallow copy of extend({}, props), the deep reactive obj of the props is a reference, so maybe cause this bug too @edison1105

edison1105

edison1105 commented on Aug 23, 2024

@edison1105
Member

@a42195472 Yes, that's true. The PR from @linzhe141 will fix this problem.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      when plain element with v-bind="obj" has style property, style property mutation is not work · Issue #11691 · vuejs/core