今天发现最近做的手机端页面 ui 用的cube-ui textarea 输入内容后点击键盘 完成 不回弹的问题
记录下来 备忘
<template> <div> <section class="cube-content"> <h2 class="cube-index-list-anchor">财务处理</h2> <div class="scroll-list-wrap"> <cube-scroll ref="scroll"> <section class="anchor"> <p>张小黑:100001ASA1L1</p> <p>参照费用:16800</p> </section> <section class="anchor"> <cube-upload :max="3" action="http://devtbsapp.origimed.com:18081/app/qa/Questions/uploadFiles.json?TOKEN=cdWsYYqJQce9FVmhwNTpcV" :simultaneous-uploads="1" @files-added="filesAdded" @file-success="fileSuccess"/> </section> <section class="anchor"> <cube-input v-model="value" :placeholder="placeholder" @focus="getFocus"></cube-input> </section> <section class="anchor"> <cube-input v-model="pay" :placeholder="pay2" @focus="getFocus"></cube-input> </section> <section class="anchor"> <cube-input v-model="time" :placeholder="time2" :readonly="readonly" @focus="showDateTimePicker"></cube-input> </section> <section class="anchor"> <cube-textarea v-model="text" :maxlength="maxlength" :placeholder="text2" @focus="getFocus"></cube-textarea> </section> <section class="anchor"> <cube-textarea v-model="explain" :maxlength="maxlength" :placeholder="text3" @focus="getFocus"></cube-textarea> </section> <section class="anchor"> <cube-button :primary="true" :disabled="disabledBtn">确定</cube-button> <cube-button class="rback">返回</cube-button> </section> </cube-scroll> </div> </section> </div> </template>
getFocus() { window.addEventListener('focusout', function () { document.body.scrollTop = document.body.scrollHeight; }) },
就是在每个input上绑定个getFocus事件
亲试好用 感谢