-
Notifications
You must be signed in to change notification settings - Fork 4.8k
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
父子两个组件,父组件的flex,无法影响子组件的flex-grow,使用:host依然无效 #3642
Comments
欢迎提交 Issue~ 如果你提交的是 bug 报告,请务必遵循 Issue 模板的规范,尽量用简洁的语言描述你的问题,最好能提供一个稳定简单的复现。🙏🙏🙏 如果你的信息提供过于模糊或不足,或者已经其他 issue 已经存在相关内容,你的 issue 有可能会被关闭。 Good luck and happy coding~ |
Hello~ 您的问题楼上已经有了确切的回答,如果没有更多的问题这个 issue 将在 15 天后被自动关闭。 如果您在这 15 天中更新更多信息自动关闭的流程会自动取消,如有其他问题也可以发起新的 Issue。 Good luck and happy coding~ |
@MuJinYan 你怎么用的,提供一下代码。 |
这个问题不是全局样式或外部样式的问题,全局样式或外部样式是针对于子组件的ui来源于其他地方的wxss的类名,这个问题实际来源于在渲染时子组件的所有标签代码默认规到了父组件的内部代码中,而不是采用正常的组件渲染代码(也就是外部没有在套一层默认的组件名标签),所以:host无效。而这种情况我又期待父组件的display:flex可以直接影响子组件的flex:1。但结果为无效。 |
@Chen-jj 稍等,我需要完成一份最简复现此问题的代码。 |
|
结论是什么,没有下文了? |
问题描述
建立了两个独立的组件,且所有代码全部分离,在父组件中使用display: flex,在子组件中使用了flex-grow:1。但子组件却未撑满屏幕,同样的代码,我将子组件的布局代码完全移动到父组件内直接书写,子内容可以完全撑满页面。根据微信开发者工具渲染出来的wxml可以看出,当采用父组件嵌套子组件的时候,结构为
而当我将子组件的代码直接复制到父组件下,结构为
因为第一张图的渲染情况,造成我采用:host{flex-grow: 1}也无法生效
复现步骤*
[复现问题的步骤]
The text was updated successfully, but these errors were encountered: