]> git.ipfire.org Git - thirdparty/vuejs/core.git/commitdiff
fix(vapor): special handling vapor props in vdom interop
authordaiwei <daiwei521@126.com>
Mon, 26 May 2025 06:11:04 +0000 (14:11 +0800)
committerdaiwei <daiwei521@126.com>
Mon, 26 May 2025 06:11:52 +0000 (14:11 +0800)
packages-private/vapor-e2e-test/interop/VaporComp.vue
packages/runtime-core/src/vnode.ts
packages/runtime-vapor/src/componentProps.ts

index 88a60c782c091edc622eaaa07db174ecf7395900..f01565449193285822157f49371502b7700475ac 100644 (file)
@@ -27,7 +27,8 @@ const slotProp = ref('slot prop')
         change slot prop
       </button>
       <div class="vdom-slot-in-vapor-default">
-        #default: <slot :foo="slotProp" />
+        #default:
+        <slot :foo="slotProp" />
       </div>
       <div class="vdom-slot-in-vapor-test">
         #test: <slot name="test">fallback content</slot>
@@ -40,7 +41,7 @@ const slotProp = ref('slot prop')
     >
       Toggle default slot to vdom
     </button>
-    <VdomComp :msg="msg">
+    <VdomComp :msg="msg" class="foo">
       <template #default="{ foo }" v-if="passSlot">
         <div>slot prop: {{ foo }}</div>
         <div>component prop: {{ msg }}</div>
index 4b31151da228a0aa7e1f81e1f3e738f7aed434fa..dc381cb12c7feda806dfadb7dae8fc71a3c8f485 100644 (file)
@@ -666,7 +666,12 @@ export function guardReactiveProps(
   props: (Data & VNodeProps) | null,
 ): (Data & VNodeProps) | null {
   if (!props) return null
-  return isProxy(props) || isInternalObject(props) ? extend({}, props) : props
+  return isProxy(props) ||
+    isInternalObject(props) ||
+    // handling for vapor props
+    props.__vapor
+    ? extend({}, props)
+    : props
 }
 
 export function cloneVNode<T, U>(
index a5e9daad229ca25c684614de03d195ebc2aee985..bde2a2ffc444f1ec2fd1d40c9ce869a46e34f2da 100644 (file)
@@ -172,6 +172,7 @@ export function getPropsProxyHandlers(
 
 export function getAttrFromRawProps(rawProps: RawProps, key: string): unknown {
   if (key === '$') return
+  if (key === '__vapor') return true
   // need special merging behavior for class & style
   const merged = key === 'class' || key === 'style' ? ([] as any[]) : undefined
   const dynamicSources = rawProps.$