Subscribe on changes!

父子组件 class 设置重叠时,class 重复

avatar
Jun 10th 2022

Vue version

3.2.37

Link to minimal reproduction

https://sfc.vuejs.org/#eyJBcHAudnVlIjoiPHNjcmlwdCBzZXR1cD5cbiAgaW1wb3J0IENvbnRlbnQgZnJvbSAnLi9Db21wLnZ1ZSdcbjwvc2NyaXB0PlxuXG48dGVtcGxhdGU+XG4gIDxDb250ZW50IGNsYXNzPVwiY29udGVudFwiPjwvQ29udGVudD5cbjwvdGVtcGxhdGU+XG48c3R5bGUgc2NvcGVkPlxuLmNvbnRlbnQge1xuICBoZWlnaHQ6IDMwMHB4O1xufVxuPC9zdHlsZT4iLCJpbXBvcnQtbWFwLmpzb24iOiJ7XG4gIFwiaW1wb3J0c1wiOiB7XG4gICAgXCJ2dWVcIjogXCJodHRwczovL3VucGtnLmNvbS9AdnVlL3J1bnRpbWUtZG9tQDMuMi4zNy9kaXN0L3J1bnRpbWUtZG9tLmVzbS1icm93c2VyLmpzXCIsXG4gICAgXCJ2dWUvc2VydmVyLXJlbmRlcmVyXCI6IFwiaHR0cHM6Ly91bnBrZy5jb20vQHZ1ZS9zZXJ2ZXItcmVuZGVyZXJAMy4yLjM3L2Rpc3Qvc2VydmVyLXJlbmRlcmVyLmVzbS1icm93c2VyLmpzXCJcbiAgfVxufSIsIkNvbXAudnVlIjoiPHRlbXBsYXRlPlxuICAgIDxkaXYgY2xhc3M9XCJjb250ZW50IHh4eFwiPlxuICAgICAgICA8ZGl2IGNsYXNzPVwiaXRlbXNcIiB2LWZvcj1cIml0ZW0gaW4gMTAwXCIgOmtleT1cIml0ZW1cIj5cbiAgICAgICAgICAgIHt7aXRlbX19XG4gICAgICAgIDwvZGl2PlxuICAgIDwvZGl2PlxuPC90ZW1wbGF0ZT5cblxuPHNjcmlwdCBzZXR1cD5cbjwvc2NyaXB0PlxuXG48c3R5bGUgc2NvcGVkID5cbi5jb250ZW50IHtcbiAgICBiYWNrZ3JvdW5kLWNvbG9yOiBhenVyZTtcbiAgICBvdmVyZmxvdzogYXV0bztcbiAgXG4gICAgLml0ZW1zIHtcbiAgICAgICAgYm9yZGVyOiAxcHggc29saWQgI2VlZWVlZTtcbiAgICAgICAgaGVpZ2h0OiAzMHB4O1xuICAgIH1cblxuXG5cbn1cbjwvc3R5bGU+In0=

Steps to reproduce

其中 父组件 设置了 class="content" , 子组件设置了 class="content xxx"

What is expected?

<div class="content xxx" data-v-37b1dc3d="" data-v-472cff63="">...</div>

What is actually happening?

<div class="content xxx content" data-v-37b1dc3d="" data-v-472cff63="">...</div>

System Info

No response

Any additional comments?

No response

avatar
Jun 10th 2022

This is expected behavior. Docs