为什么这样传递参数无法触发组件的渲染? #12156
Lin9672
started this conversation in
General Discussions
为什么这样传递参数无法触发组件的渲染?
#12156
Replies: 1 comment 7 replies
-
resolve((p) => {
console.log('异步组建的props', p);
return h(Comp1, { testObject: p }); // <--
}); 因为例子中 Comp1 的 props 没有改变过, 你可以这样改:Playground |
Beta Was this translation helpful? Give feedback.
7 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Link to minimal reproduction
https://play.vuejs.org/#eNqVVE9v00gU/ypPvthVU2dZFmmVpt1l2R52D4CAoyXk2C+JW2c8mhmniaJIiD8SHEBIoB7gAhJFHAD1gJCglfgydRDfgjczcexAKSJSkpn39/fe/N6bOOc594c5Oi2nLSORcAUSVc43A5YMeCYUTEBgtwExdhOG5+WYRRcy0jBkqgH9huyHaZrtXtE2u6GK+lvdLkYKptAV2QBciu0uYmnPM3OF3zQ3ndxdD1jAooxJBQMUPbwsMi5hQ2f2JqBQKi1BocYtcL+83Ju9fv75ye3ixpEL0xVytq5RljM19/qtEvdDFqd4gf56SFpvBTY2YRIwqOXyh2Gao1/PRKbu7Om72d5B8fBBmW3VJrHmq6uUY1pB/3fMwkFStYciVN3xVrRhrUNeDYj2z1L006znucXdp8Xhx+Lo5uzN/ufD28eH713yhe/CWxCU5KSn8UxcgDQLYxStedUMd4HqGyQSPU8g5RxihUJ/5kLP48vybzGW6Agp9YbrHroN4LrrpYMgHgkGfc+8cwMmuruXOttUewu4eTdruDhOTZ36V3/bTUtIoiJdFA54GiqkG0A7ToYg1TjFjcCJE0kaYkY3xdG6+V2LE0Fpkoy1CHeaD9g69ELegj/5aD1wTAwdxXZ0LVq82HCtk7CYglbUCJxmad/JlcoY/B2lSbRDRnVmUdTjT29njz8UL/a+3Hp1fPSsuLNPramKbjetv62gSSXQqd2sFeY0HCWpz92k52/LjNFQmgcIHI0wSVFc4roowtQqnyZwDMP+NzIlcmyU8qiP0c4J8m050rLAuUyPjWJI0Bc6FVLZyqq3rl7EEZ0XykEW5ylZn6K8oumTa4zW7J9cd0jU7Aza/8w6SFjvmtwaKWSyLEoDNRww9oFDy0Gz50elV3DP+n8YP6IOdXGxWU5Ya7XFZqZxaVMtloZh9GK2DBHsSNVJPMehxhxbYIUlCDPtyyPz5qGdZru/Zg/2Z4/fF3cPauNjs+pp+Bn3ozSUkhjYE1nOa4Q2nLJTVQfa5gI3J7UBnE7bTS2b+83JeEqMpdV4QsC/lgxOCf/tDNnFVO+UaYIJZ0OvUH2ze4+K+we/Mkt0NQuCjr7pkn2t5WWhJT/YF1pVrQy6dDJhNuk5PgLCmsTQScNox+h4GMfE5tKYCEAPaLITGa8PUWiCExfP+uf8M787068VOK/n
点击按钮更新外部传入的testObject,子组件的视图没有更新,打印子组件接收到的props可以发现props的值已经变化了,这是为什么?
Beta Was this translation helpful? Give feedback.
All reactions