]> git.ipfire.org Git - thirdparty/vuejs/core.git/commitdiff
fix(compat): should not warn COMPILER_V_BIND_OBJECT_ORDER when using v-bind together...
authoryangxiuxiu <79584569+yangxiuxiu1115@users.noreply.github.com>
Thu, 22 May 2025 00:44:34 +0000 (08:44 +0800)
committerGitHub <noreply@github.com>
Thu, 22 May 2025 00:44:34 +0000 (08:44 +0800)
fix #12992

packages/compiler-core/src/transforms/transformElement.ts
packages/vue-compat/__tests__/compiler.spec.ts

index 76ca1d44353da1b74d398fa4b4d567779eb77d61..1dca0c514c16237d1adbe551375f56f078db27be 100644 (file)
@@ -594,11 +594,9 @@ export function buildProps(
         hasDynamicKeys = true
         if (exp) {
           if (isVBind) {
-            // #10696 in case a v-bind object contains ref
-            pushRefVForMarker()
-            // have to merge early for compat build check
-            pushMergeArg()
             if (__COMPAT__) {
+              // have to merge early for compat build check
+              pushMergeArg()
               // 2.x v-bind object order compat
               if (__DEV__) {
                 const hasOverridableKeys = mergeArgs.some(arg => {
@@ -641,6 +639,9 @@ export function buildProps(
               }
             }
 
+            // #10696 in case a v-bind object contains ref
+            pushRefVForMarker()
+            pushMergeArg()
             mergeArgs.push(exp)
           } else {
             // v-on="obj" -> toHandlers(obj)
index 2ae2f211a108a0c7ef56d6fd97d1fa2213fc379b..68bb6e987bcd3156b34c25fc7b08abca60bd224a 100644 (file)
@@ -93,6 +93,16 @@ test('COMPILER_V_BIND_OBJECT_ORDER', () => {
   ).toHaveBeenWarned()
 })
 
+test('should not warn COMPILER_V_BIND_OBJECT_ORDER work with vFor', () => {
+  const vm = new Vue({
+    template: `<div><div v-bind="{ id: 'bar', class: 'baz' }" v-for="item in 5" /></div>`,
+  }).$mount()
+  expect(vm.$el).toBeInstanceOf(HTMLDivElement)
+  expect(
+    CompilerDeprecationTypes.COMPILER_V_BIND_OBJECT_ORDER,
+  ).not.toHaveBeenWarned()
+})
+
 test('COMPILER_V_ON_NATIVE', () => {
   const spy = vi.fn()
   const vm = new Vue({