Scoped slot problem - 作用域插槽问题 #11405
Replies: 5 comments 1 reply
-
<div :style="{height: height.value + 'px',background:'red'}"></div> |
Beta Was this translation helpful? Give feedback.
-
Or use <slot :height="toValue(obj.a)" /> |
Beta Was this translation helpful? Give feedback.
-
这确实是一种解决方法,但是按照template内ref自动解析而言,这种解决方法无疑增加了心智成本,所以看是否能自动解析出来。 |
Beta Was this translation helpful? Give feedback.
-
这么看只对了当前组件的setup返回值做了处理 |
Beta Was this translation helpful? Give feedback.
-
This is expected behavior and the types indicates it is indeed an unwrapped ref inside the template. Changing it would be a breaking change so it's not going to be considered. Moving to discussion instead. |
Beta Was this translation helpful? Give feedback.
-
Vue version
v3.4.32
Link to minimal reproduction
https://play.vuejs.org/#eNp9kk2PmzAQhv/KyBe2KgU1zYmylfqxh/bQVk2PvhCYEGeNbdkmzRbx3zuGkMCqm+SAPfN65vX46dhHY5JjiyxjuSutMB4c+tZ84Eo0RlsPnddfhDOyeNp4K1Qdg9K2KaT4ixv/JLGHndUNRFQkuhz6rBtzjidp2IQe0XuuSq2clphIXd89L/yWfq+WkmWreLVakaDCbVvXaLniKk9H1+SXNh4bqueRdgB56DusaD1l4PjGSe3vOev2KOq97zk7awC6KdZPkbwSR8hcaH49ksH4hdcQmVMUb4vysba6VVUWWayiUDJP6eTUPF36GgZCy0WcKxYz7+jyO1EnB6cVPUkX9JyVpBcS7Q/jBQ2HswyGTMgVUuo/34aYty3GU7zcY/n4n/jBnUKMs58WHdojcnbJ+cLW6Mf0w+Y7nmh9STa6aiWpbyR/IT1cGzyOsk80ErI90w1uvw6M0Iv/dg8nj8pNlwpGg7If9JwRM2FUL139avddsh7OcdXTFCfebjBtkSiyGyJhji/xOQnA4g6e5eZgXgvE6/X6TK0HvT3A/eiwyEKNu0A0+VpSO//fInjGUKAWshE8QpEaJQVnkJ6RGpULolj/D5nYUUY=
Steps to reproduce
无
What is expected?
I hope to automatically resolve the value of ref in the object。
希望能自动解析出对象内ref的值
What is actually happening?
When the scoped slot accesses the nested child component data, the parent component does not automatically parse the value, and you can see that the element height assignment does not take effect。
作用域插槽访问嵌套子组件数据时父组件没有自动解析出值,可以看到元素高度赋值未生效
System Info
No response
Any additional comments?
No response
Beta Was this translation helpful? Give feedback.
All reactions