textarea 文字中间修改,修改完,光标跑到最后一个去

发布于 7 年前作者 rlei2642 次浏览最后编辑 7 年前来自 ask

textarea 写上一段文字,在文字中间部位修改,文字输入完光标立马定位到尾部,ios的出现这个问题,安卓是正常的,

问题重现:搜    风尚婚礼人      ==> 简单填写信息  ==> 我的  ==> 发布作品  ==> textarea

4 回复
tsong
tsong1 楼6 年前

<textarea class=“area” wx:if=“{{!opacityTextarea}}” cursor=“{{cursorIndex}}”

focus=“{{true}}” name=“content” selection-start=“{{cursorIndex}}”

selection-end=“{{cursorIndex}}” bindfocus=“bindfocus”

bindinput=“getTextareaValue” value=“{{content}}” placeholder=“描述下你的作品吧…”

show-confirm-bar=“{{false}}” />

getTextareaValue(e) {

    let { value, cursor } = e.detail;

    this.content = value;

    this.cursorIndex = Number(cursor);

    console.info(‘cursorIndex’, this.cursorIndex, ‘typeof’, typeof this.cursorIndex, ‘content’, content);

    this.$apply();

},

不起作用呀???

fang01
fang012 楼6 年前

没有哦,一直是遗留的bug到现在

cdu
cdu3 楼6 年前

遇到同样问题

fengmin
fengmin4 楼5 年前

遇到同样的问题,请问你找到解决办法了吗