Skip to content

Commit 93949e6

Browse files
fix(compat): should not warn COMPILER_V_BIND_OBJECT_ORDER when using v-bind together with v-for (#12993)
fix #12992
1 parent 949df80 commit 93949e6

File tree

2 files changed

+15
-4
lines changed

2 files changed

+15
-4
lines changed

packages/compiler-core/src/transforms/transformElement.ts

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -594,11 +594,9 @@ export function buildProps(
594594
hasDynamicKeys = true
595595
if (exp) {
596596
if (isVBind) {
597-
// #10696 in case a v-bind object contains ref
598-
pushRefVForMarker()
599-
// have to merge early for compat build check
600-
pushMergeArg()
601597
if (__COMPAT__) {
598+
// have to merge early for compat build check
599+
pushMergeArg()
602600
// 2.x v-bind object order compat
603601
if (__DEV__) {
604602
const hasOverridableKeys = mergeArgs.some(arg => {
@@ -641,6 +639,9 @@ export function buildProps(
641639
}
642640
}
643641

642+
// #10696 in case a v-bind object contains ref
643+
pushRefVForMarker()
644+
pushMergeArg()
644645
mergeArgs.push(exp)
645646
} else {
646647
// v-on="obj" -> toHandlers(obj)

packages/vue-compat/__tests__/compiler.spec.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,16 @@ test('COMPILER_V_BIND_OBJECT_ORDER', () => {
9393
).toHaveBeenWarned()
9494
})
9595

96+
test('should not warn COMPILER_V_BIND_OBJECT_ORDER work with vFor', () => {
97+
const vm = new Vue({
98+
template: `<div><div v-bind="{ id: 'bar', class: 'baz' }" v-for="item in 5" /></div>`,
99+
}).$mount()
100+
expect(vm.$el).toBeInstanceOf(HTMLDivElement)
101+
expect(
102+
CompilerDeprecationTypes.COMPILER_V_BIND_OBJECT_ORDER,
103+
).not.toHaveBeenWarned()
104+
})
105+
96106
test('COMPILER_V_ON_NATIVE', () => {
97107
const spy = vi.fn()
98108
const vm = new Vue({

0 commit comments

Comments
 (0)