Weex下父类的样式为flex-direction: row,会导致子类input标签宽度变0,无法显示出来

今天在Weex开发的时候,发现一个问题,不知道是不是我独有的?

如果一个父类(如下的row-wrapper)css有这个属性:

flex-direction: row;

会导致它子类的input标签元素宽度一直为零。
PS:在web端没问题,如果你用weex-playground调试工具在手机端打开,就无法正常显示了,有遇到同样问题的小伙伴吗??

<template>
  <div class="row-wrapper">
    <input type="text"/>
    <text>textdemo</text>
  </div>
</template>

<script>
export default {
  name: 'login',
  data () {
    return {
    }
  }
}
</script>

<style scoped>
.row-wrapper {
  flex-direction: row;
}

</style>
阅读 3.6k
1 个回答

问题找到了。。。。在父类设置flex-direction: row;的时候,子类的这个input元素一定要设置它的宽高。

比如flex:1或者width:200px,才能正确显示,而且必须添加成class类才能正确编译,直接用元素标签值是不可行的。

不得不说有点坑啊,flex-direction: colum;的时候就不会有这个问题,很迷。。。。

推荐问题