要把justify-content用在starContainer這個容器里。效果和代碼如下.starContainer?{
??display:?flex;
??justify-content:?flex-start;
}紅箭頭的那一列就是starContainer作用的區域,明顯不是justify-content: flex-start;一開始覺得可能是因為不是view組件,就給每一個組件包上view,不行。然后starContainer里加上flex-direction:row也沒成功。雖然小程序代碼使用的是flex布局,但是畢竟也屬于css,所以想請問一下大神們,這是什么原因呢???小程序代碼wxml<view?class="container">
????<view?class="starContainer">
??????<view?class="date">2017-11-4</view>
??????<image?class="authorImage"?src="/images/avatar/4.png"?/>
??????<view?class="textAuthor">嘻嘻里嘻嘻里</view>
????</view>
????<text?class="textWords">
??????“特朗普如此反復無常且不受任何核心承諾或理念的約束,以至于在外界看來,他相當不靠譜,”達萊克說,“這給美國傳統的治國和外交方略蒙上了一層陰影,而且使外交官們在開展工作時多了很多困惑?!?????</text>
????<view?class="dateDiscuss">
??????<view?class="likeText">8星</view>
??????<image?class="starImage"?src="/images/icon/starB.jpg"?/>
????</view>
??</view>小程序wxss代碼.container?{
??display:?flex;
??flex-direction:?column;
??margin-top:?20rpx;
??margin-bottom:?40rpx;
??margin-left:?0rpx;
??background-color:?#fff;
??border-bottom:?1px?solid?#ededed;
??border-top:?1px?solid?#ededed;
??padding-bottom:?5px;
}
.likeText?{
??font-size:?30rpx;
??margin-right:?30rpx;
}
.starContainer?{
??display:?flex;
??justify-content:?flex-start;
}
.authorImage?{
??width:?32rpx;
??height:?32rpx;
??/*?margin:?0rpx?10rpx?0rpx?30rpx;?*/
}
.starImage?{
??width:?32rpx;
??height:?32rpx;
}
.textAuthor?{
??font-size:?32rpx;
??color:?#68228b;
}
.textWords?{
??font-size:?32rpx;
??color:?#333;
??margin-left:?10rpx;
??margin-bottom:?15rpx;
}
.date?{
??font-size:?32rpx;
??color:?#68228b;
}
.dateDiscuss?{
??display:?flex;
??margin-left:?450rpx;
}解決方法設置 width: 100%;就可以了??吹倪@個網址https://segmentfault.com/q/1010000006231565
- 0 回答
- 0 關注
- 12615 瀏覽
相關問題推薦
添加回答
舉報
0/150
提交
取消