-
Notifications
You must be signed in to change notification settings - Fork 2.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
组件嵌套slot问题 #427
Comments
感觉是 mpvue 的问题,@anchengjian |
这问题我昨晚也遇到了, 看生成的模板排查到凌晨也定位到了这里, 原来已经有issue了😖😖. |
实测无误 @F-loat 上下文为:
PR 已提交 #458, |
@shawtung input闪烁的问题是双向绑定机制的问题, 我弄了个workaround #241 (comment) |
这个修改会带来另外一个问题。具体Demo如下: pages/index/index.vue
child.vue
flag.vue
在fix之前,会只显示"desc",这是已知问题。 希望能看看这个问题。谢谢 |
@XieShangxu 那你试试这样?
|
@Stupidism 还是不行,跟fix之前是一样的 |
@XieShangxu 这样 |
@XieShangxu 这样行了吗? |
@Stupidism 先p再k是对的, 我测试过了. 先k再p导致($k, $kk, $p)变成了其父组件的值, 相当于这一组件层级往上移了一级, 导致它里面的组件也会错位, 就找不到相应的组件data了. |
@shawtung 所以是应该改成什么?这里组件嵌套可能会导致差异,目前的改法有嵌套时应该是正确的,当时有测过 |
@F-loat 我的场景是把组件B放进组件A的slot里, 1.0.12把 改成开头说的那样之后, 就都OK了. 不过我还没有试组件循环引用的场景... 我再去试试. |
这个好像真不好改 <child>
<div>{{product.desc}}</div>
</child> 这里编译后的slot用的作用域应该是父的,所以要 <child>
<flag :text="product.name" />
</child> 这里的slot是个组件, <template data="{{...$root[$p], $root}}" is="{{$slotdefault || 'default'}}"></template> @shawtung 按照你的改法也不行吧,当前的作用域会覆盖父的作用域吧,这样还是可能会有问题 |
[组件嵌套]
问题复现步骤:
生成的模版是
结果tab组件接收到的数据为空
问题就出在
$root[$p]
这里,看了mpvue-template-compiler,把L4583行的改成
就可以
所以我就不明白了,是我使用姿势不对,还是确实是mpvue本身有问题
具体demo在https://github.com/yun77op/vue-wechat-web/blob/master/src/pages/index/index.vue
The text was updated successfully, but these errors were encountered: