【发布时间】:2019-07-09 10:35:20
【问题描述】:
我正在设置一个聊天应用,聊天气泡不应超过一定的宽度(例如屏幕的 80% 左右)。
我从另一篇文章中读到,他们都提到用布局包装标签,它在 Android 中很有效,但在 iOS 中没有。
...
<ScrollView row="1" background="#fafafa" ref='scrollView'>
<FlexboxLayout flexDirection="column" justifyContent="flex-end">
<GridLayout v-for="chat in processedChats" :key="chat.timestamp" rows='*' backgroundColor="#fafafa" >
<FlexboxLayout row='0' v-if="chat.speaker == me" flexDirection="row" justifyContent="flex-end">
<Label :text="chat.content" :textWrap="true" padding="10" margin="5 5 5 10" fontSize="16" background="#222222" color="#ffffff" borderRadius="15" />
<Label text="" width="40%" />
</FlexboxLayout>
<FlexboxLayout row='0' v-else flexDirection="row" justifyContent="flex-start">
<Label :text="chat.content" :textWrap="true" padding="10" margin="5 5 5 10" fontSize="16" background="#f1f0f0" color="#484848" borderRadius="15" />
<Label text="" width="40%" />
</FlexboxLayout>
</GridLayout>
</FlexboxLayout>
</ScrollView>
...
这是奇怪的布局结果。
【问题讨论】:
标签: ios vue.js nativescript