如何解决Nativescript-vue:如何构建聊天模板
正如我们都知道的 WhatsApp 一样,我想建立一个小型聊天室。 目前我可以在 ListView 中显示消息。
<template>
<Page>
<ListView separatorColor="transparent" for="item in messages">
<v-template>
<GridLayout>
<TextView
height="auto"
editable="false"
:text="item.message"
/>
</GridLayout>
</v-template>
</ListView>
</Page>
</template>
我的下一步是在页面末尾添加一个带有 Button 的 TextView。但我的问题来了:
- 我应该选择哪个布局组件将 TextView 放置在页面底部。
- 如果我进入可编辑的 TextView,虚拟键盘会与我的当前页面重叠。相反,它应该调整整个页面的大小。我该怎么做?
这是我目前的游乐场项目:https://play.nativescript.org/?template=play-vue&id=F8lXkO
编辑: 我找到了一种使用 DockLayout 在 Android 上工作的方法: https://play.nativescript.org/?template=play-vue&id=F8lXkO&v=3
不幸的是,这只适用于操场。在 android 上使用最新的 nativescript 版本不起作用。如果我在 TextView 上标签,布局会中断 => https://github.com/sowinski/nativescript-vue-chat
解决方法
对整个视图使用 GridLayout。您可以将其用作指南 - https://github.com/Especializa/nativescript-whatsapp-template 使用它可以更好地理解 Nativescript 布局 - https://www.nslayouts.com/
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。