Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Velpro187
uni-app
提交
63a20d17
U
uni-app
项目概览
Velpro187
/
uni-app
与 Fork 源项目一致
Fork自
DCloud / uni-app
通知
1
Star
1
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
U
uni-app
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
未验证
提交
63a20d17
编写于
2月 26, 2021
作者:
L
linju-json
提交者:
GitHub
2月 26, 2021
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
【textarea唤起软键盘 点击发送 会换行而不是发送】的场景示例
上级
afdc5ff2
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
36 addition
and
0 deletion
+36
-0
docs/component/textarea.md
docs/component/textarea.md
+36
-0
未找到文件。
docs/component/textarea.md
浏览文件 @
63a20d17
...
...
@@ -89,6 +89,42 @@ export default {
-
软键盘的弹出和收起逻辑,详见
[
input的文档
](
/component/input?id=app%E5%B9%B3%E5%8F%B0ios%E7%AB%AF%E8%BD%AF%E9%94%AE%E7%9B%98%E4%B8%8A%E6%96%B9%E6%A8%AA%E6%9D%A1%E5%8E%BB%E9%99%A4%E6%96%B9%E6%A1%88
)
-
如需禁止点击其他位置收起键盘的默认行为,可以监听
`touch`
事件并使用
`prevent`
修饰符(仅支持App-v3、H5,其他平台可以通过设置
`focus`
来使输入框重新获取焦点),例如在确认按钮上使用:
```@touchend.prevent="onTap"```
nvue下键盘右下角按钮点击仅触发换行;如想监听该按钮事件可以参考,示例代码如下:
```
<template>
<view class="content">
<textarea class="textarea" v-model="txt"></textarea>
</view>
</template>
<script>
export default {
data() {
return {
txt:"txt"
}
},
watch: {
txt(txt) {
if( txt.indexOf('\n') != -1 ){ //敲了回车键了
uni.hideKeyboard() //收起软键盘
}
}
},
methods: {
}
}
</script>
<style>
.textarea{
border: solid 1px red;
}
</style>
```
**富文本编辑的解决方案**
在输入框里图文混排内容,在web上该功能依赖document,而小程序和app的正常页面又没有document。
-
方式一:使用uni-app自带的
`editor`
组件,该组件支持App、H5、微信小程序,其他家小程序自身未提供这类解决方案。
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录