赞
踩
最近使用vant和vue开发项目时,发现表单元素过多,点击靠近屏幕尾部的文本框,发现顶部导航栏header被顶起。
话不多说,先扫码体验下这个bug。请用苹果手机,微信扫码。
三、软键盘收回,顶部导航栏又返回到顶部位置
四、相关代码
- <template>
- <div class="home">
- <van-nav-bar
- title="顶部导航固定测试(苹果机)"
- left-arrow
- fixed
- />
-
- <van-form @submit="onSubmit" style="position: relative; top: 50px; left: 0; width: 100%;">
- <van-field
- v-model="username"
- name="用户名"
- label="用户名"
- placeholder="用户名"
- :rules="[{ required: true, message: '请填写用户名' }]"
- />
- <van-field
- v-model="password"
- type="password"
- name="密码"
- label="密码"
- placeholder="密码"
- :rules="[{ required: true, message: '请填写密码' }]"
- />
- <van-field
- v-model="username1"
- name="用户名1"
- label="用户名1"
- placeholder="用户名1"
- :rules="[{ required: true, message: '请填写用户名1' }]"
- />
- <van-field
- v-model="password1"
- type="password1"
- name="密码1"
- label="密码1"
- placeholder="密码1"
- :rules="[{ required: true, message: '请填写密码1' }]"
- />
- <van-field
- v-model="username2"
- name="用户名2"
- label="用户名2"
- placeholder="用户名2"
- :rules="[{ required: true, message: '请填写用户名2' }]"
- />
- <van-field
- v-model="password2"
- type="password2"
- name="密码2"
- label="密码2"
- placeholder="密码2"
- :rules="[{ required: true, message: '请填写密码2' }]"
- />
- <div style="margin: 16px;">
- <van-button round block type="info" native-type="submit">
- 提交
- </van-button>
- </div>
- </van-form>
- </div>
- </template>
-
- <script>
- // @ is an alias to /src
-
-
- export default {
- name: 'Home',
- components: {},
- data(){
- return {
- username: '',
- password: '',
- username1: '',
- password1: '',
- username2: '',
- password2: ''
- }
- },
- methods: {
- onSubmit(values) {
- console.log('submit', values);
- },
- }
- }
- </script>
大神们,有没有遇到这种问题,希望技术大牛们一起讨论下,如何解决这个问题。
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。