今天在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>
问题找到了。。。。在父类设置
flex-direction: row;
的时候,子类的这个input
元素一定要设置它的宽高。比如
flex:1
或者width:200px
,才能正确显示,而且必须添加成class类才能正确编译,直接用元素标签值是不可行的。不得不说有点坑啊,
flex-direction: colum;
的时候就不会有这个问题,很迷。。。。