]> git.ipfire.org Git - thirdparty/vuejs/core.git/commitdiff
chore: tweaks
authordaiwei <daiwei521@126.com>
Thu, 3 Jul 2025 08:44:22 +0000 (16:44 +0800)
committerdaiwei <daiwei521@126.com>
Thu, 3 Jul 2025 08:46:10 +0000 (16:46 +0800)
packages/runtime-vapor/__tests__/componentAttrs.spec.ts
packages/runtime-vapor/__tests__/componentSlots.spec.ts
packages/runtime-vapor/src/componentProps.ts

index 6fef2ba601e06fbf22128ca7c32e5cecf31400de..8d7af61234c6d41e75272de91c5d21e55c711ce6 100644 (file)
@@ -472,6 +472,6 @@ describe('attribute fallthrough', () => {
 
     const root = document.createElement('div')
     createApp(App).use(vaporInteropPlugin).mount(root)
-    expect(root.innerHTML).toBe('<div foo="vapor foo" bar="bar"></div>')
+    expect(root.innerHTML).toBe('<div foo="foo" bar="bar"></div>')
   })
 })
index d6f4c0af30f76ea7019d0613820baf7f9c2fb702..58076fff9eea213c8180d87ef5ed089951560798 100644 (file)
@@ -241,11 +241,14 @@ describe('component: slots', () => {
         }),
       ).render()
 
-      // foo has higher priority than bindObj.foo
-      expect(props).toEqual({ foo: 0, baz: 'qux' })
+      expect(props).toEqual({ foo: 100, baz: 'qux' })
 
       foo.value = 2
       await nextTick()
+      expect(props).toEqual({ foo: 100, baz: 'qux' })
+
+      delete bindObj.value.foo
+      await nextTick()
       expect(props).toEqual({ foo: 2, baz: 'qux' })
     })
 
index a8fbafd5f9fd243415f5cae2d7af3669b670200e..9cf65c57143a4f72b3b466cd5732bde7cd5cead1 100644 (file)
@@ -178,16 +178,6 @@ export function getAttrFromRawProps(rawProps: RawProps, key: string): unknown {
   if (key === '$') return
   // need special merging behavior for class & style
   const merged = key === 'class' || key === 'style' ? ([] as any[]) : undefined
-
-  // rawProps has high priority
-  if (hasOwn(rawProps, key)) {
-    if (merged) {
-      merged.push(rawProps[key]())
-    } else {
-      return rawProps[key]()
-    }
-  }
-
   const dynamicSources = rawProps.$
   if (dynamicSources) {
     let i = dynamicSources.length
@@ -206,7 +196,13 @@ export function getAttrFromRawProps(rawProps: RawProps, key: string): unknown {
       }
     }
   }
-
+  if (hasOwn(rawProps, key)) {
+    if (merged) {
+      merged.push(rawProps[key]())
+    } else {
+      return rawProps[key]()
+    }
+  }
   if (merged && merged.length) {
     return merged
   }