Is there a conflict between manually adding a class and binding a class using Vue? #12150
Replies: 2 comments 5 replies
-
class2.value = true;
await nextTick();
el.value?.classList.add('class1'); |
Beta Was this translation helpful? Give feedback.
-
When I read this this in the template:
The way I see it, you are simply overwriting what you did with So, as @jacekkarczmarczyk suggested, manipulating the DOM-node directly is probably not a good idea. Side note: <h1 :class="{ class2 }" class="class1 class3"> |
Beta Was this translation helpful? Give feedback.
-
Link to minimal reproduction
https://play.vuejs.org/#eNp9Uk1v2zAM/SucLk6BzEa2nTInwzYU2IZtLdoCveji2kyiVpYEfaQpDP/3UlKSpkBR+GLyPZKPjxrYd2PKbUA2Z7VrrTAeHPpgllyJ3mjrYQCt/umgPHYwwsrqHgoqKL6eMCyuXmFccdVq5Tz0bg2LiE+KXyilhlttZfehODsQWtk492nPWTXS4RFCuU9TJn5HHZPJGSyWMHAFRCq3jQz4rUyd/grny6brJkUKZ3FQpFUVtLrvMa2hg5/mwTN4FFLCHQLVENJqa7H18inWZGm5PSnxNiBX415MXWW7yCgKPPZGNh4pAqg3syh7wRlKzmCe+lA0HJYdOVsOQ/JmHOtqM8tlQpngYfux1x1K4hNO5RWBdXUygE2Zd+TQSqzLe6cVnS45wRltaIREe2G8IAc5m2ePItaQ+Y9/Ui4uMj3k2w22D2/k790u5ji7tOjQbpGzI+Ybu0af4fPr/7ij/yNI6oMk9jvgFTotQ9SYaT+C6kj2CS+p/Z2el1DrG3e+86jcYal8CYAx8TmjJ/fzndVf5H4uv6Q6OiMbnwExk/9r
As shown in the screenshot, the manually added class is being ignored.
Beta Was this translation helpful? Give feedback.
All reactions