会员
周边
众包
新闻
博问
闪存
赞助商
Chat2DB
所有博客
当前博客
我的博客
我的园子
账号设置
会员中心
简洁模式
...
退出登录
注册
登录
AtlasLapetos
博客园
首页
新随笔
联系
订阅
管理
随笔 - 2649 文章 - 2452 评论 - 0 阅读 -
80424
<textarea>
</h1> <h2 id="简介"><a href="https://weexapp.com/zh/docs/components/textarea.html#%E7%AE%80%E4%BB%8B" target="_blank">#</a>简介</h2> <p><code><textarea></code> 与 <a href="https://weexapp.com/zh/docs/components/input.html" target="_blank">``</a> 组件类似,可用于接受用户输入数据。<code><textarea></code> 支持多行文本输入。 <code><textarea></code> 支持 <code><input></code> 支持的所有的属性、样式和事件。</p> <h2 id="子组件"><a href="https://weexapp.com/zh/docs/components/textarea.html#%E5%AD%90%E7%BB%84%E4%BB%B6" target="_blank">#</a>子组件</h2> <p><code><textarea></code> 不支持子组件。</p> <h2 id="属性"><a href="https://weexapp.com/zh/docs/components/textarea.html#%E5%B1%9E%E6%80%A7" target="_blank">#</a>属性</h2> <p>除了支持 <code>input</code> 支持的所有属性外,<code>textarea</code> 还支持 <code>rows</code> 属性,用于指定输入的行数。</p> <ul> <li><strong>rows</strong>, number, 默认值为2。</li> </ul> <h2 id="样式"><a href="https://weexapp.com/zh/docs/components/textarea.html#%E6%A0%B7%E5%BC%8F" target="_blank">#</a>样式</h2> <h4 id="通用样式"><a href="https://weexapp.com/zh/docs/components/textarea.html#%E9%80%9A%E7%94%A8%E6%A0%B7%E5%BC%8F" target="_blank">#</a>通用样式</h4> <ul> <li>支持所有<a href="https://weexapp.com/zh/docs/styles/common-styles.html" target="_blank">通用样式</a>。</li> </ul> <h4 id="伪类样式"><a href="https://weexapp.com/zh/docs/components/textarea.html#%E4%BC%AA%E7%B1%BB%E6%A0%B7%E5%BC%8F" target="_blank">#</a>伪类样式</h4> <ul> <li><strong>active</strong></li> <li><strong>disabled</strong></li> <li><strong>enbaled</strong></li> <li><strong>focus</strong></li> </ul> <p><code>active</code> 和 <code>focus</code> 的区别在于,当光标位于输入框里时,它就是 focus 状态,而只有触摸输入框时它才是 active 的状态。</p> <h4 id="文本样式"><a href="https://weexapp.com/zh/docs/components/textarea.html#%E6%96%87%E6%9C%AC%E6%A0%B7%E5%BC%8F" target="_blank">#</a>文本样式</h4> <ul> <li>请参考<a href="https://weexapp.com/zh/docs/styles/text-styles.html" target="_blank">文本样式</a></li> </ul> <h2 id="事件"><a href="https://weexapp.com/zh/docs/components/textarea.html#%E4%BA%8B%E4%BB%B6" target="_blank">#</a>事件</h2> <ul> <li> <p><strong>通用事件</strong> 支持所有<a href="https://weexapp.com/zh/docs/events/common-events.html" target="_blank">通用事件</a>。</p> </li> <li> <p>input</p> <p>. 当输入状态时,会不断触发。</p> <ul> <li>@param value: 当前文本。</li> </ul> </li> <li> <p>change</p> <p>. 当用户完成了输入时触发。</p> <ul> <li>@param value: 当前文本。</li> </ul> </li> <li> <p><strong>focus</strong>. 当输入框获得焦点时触发。</p> </li> <li> <p><strong>blur</strong>. 当输入框失去焦点时触发。</p> </li> <li> <p>return</p> <p>. 当用户点击了“回车”按钮时触发,会返回此时“回车”按钮的动作类型。</p> <ul> <li>@param value: 当前文本。</li> <li>@param returnKeyType, "default" | "go" | "next" | "search" | "send" | "done".</li> </ul> </li> <li> <p>keyboard</p> <p>. 当键盘弹起或收起时触发。</p> <ul> <li>@param isShow: boolean, 显示或隐藏键盘。</li> <li>@param keyboardSize: 键盘的高度,以前端使用的样式单位返回。</li> </ul> </li> </ul> <h2 id="vue-示例"><a href="https://weexapp.com/zh/docs/components/textarea.html#vue-%E7%A4%BA%E4%BE%8B" target="_blank">#</a>Vue 示例</h2> <pre><code class="language-html"><template> <div class="wrapper"> <textarea class="textarea" @input="oninput" @change="onchange" @focus="onfocus" @blur="onblur"></textarea> </div> </template> <script> const modal = weex.requireModule('modal') export default { methods: { oninput (event) { console.log('oninput:', event.value) modal.toast({ message: `oninput: ${event.value}`, duration: 0.8 }) }, onchange (event) { console.log('onchange:', event.value) modal.toast({ message: `onchange: ${event.value}`, duration: 0.8 }) }, onfocus (event) { console.log('onfocus:', event.value) modal.toast({ message: `onfocus: ${event.value}`, duration: 0.8 }) }, onblur (event) { console.log('onblur:', event.value) modal.toast({ message: `input blur: ${event.value}`, duration: 0.8 }) } } } </script> <style> .textarea { font-size: 50px; width: 650px; margin-top: 50px; margin-left: 50px; padding-top: 20px; padding-bottom: 20px; padding-left: 20px; padding-right: 20px; color: #666666; border-width: 2px; border-style: solid; border-color: #41B883; } </style> </code></pre> <ul> <li><a href="http://dotwe.org/vue/a1877866e8b91ffa1e6ea9bc66c200fa" target="_blank">示例</a></li> <li><a href="http://dotwe.org/vue/2ba8ebc4e6970e1e86725c3e80296e40" target="_blank">事件示例</a></li> <li><a href="http://dotwe.org/vue/d884b0c18891a05d653253c0f0a94bc1" target="_blank">绑定示例</a></li> </ul> <h2 id="rax-示例"><a href="https://weexapp.com/zh/docs/components/textarea.html#rax-%E7%A4%BA%E4%BE%8B" target="_blank">#</a>Rax 示例</h2> <p><code>rax-textinput</code> 是 <code><textarea></code> 组件的上层封装,抹平了 Web 和 Weex 的展现</p> <pre><code class="language-jsx">import { createElement, render } from "rax"; import Driver from 'driver-universal'; import TextInput from "rax-textinput"; function App() { return ( <View style={{margin: '20rpx'}}> <TextInput multiline={true} numberOfLines={3} style={{ height: '150rpx', width: '600rpx', borderWidth: '1rpx', borderColor: '#dddddd', borderStyle: 'solid' }} /> </View> ); } render(<App />, document.body, { driver: Driver }); </code></pre> <p><a href="https://rax.js.org/docs/components/textinput" target="_blank">rax-textinput 文档</a></p>
分类:
weex / 内置组件
好文要顶
关注我
收藏该文
微信分享
AtlasLapetos
粉丝 -
0
关注 -
2
+加关注
0
0
升级成为会员
posted on
2024-12-09 14:00
AtlasLapetos
阅读(
8
) 评论(
0
)
编辑
收藏
举报
刷新页面
返回顶部
登录后才能查看或发表评论,立即
登录
或者
逛逛
博客园首页
【推荐】还在用 ECharts 开发大屏?试试这款永久免费的开源 BI 工具!
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
编辑推荐:
·
开发者必知的日志记录最佳实践
·
SQL Server 2025 AI相关能力初探
·
Linux系列:如何用 C#调用 C方法造成内存泄露
·
AI与.NET技术实操系列(二):开始使用ML.NET
·
记一次.NET内存居高不下排查解决与启示
阅读排行:
·
阿里最新开源QwQ-32B,效果媲美deepseek-r1满血版,部署成本又又又降低了!
·
开源Multi-agent AI智能体框架aevatar.ai,欢迎大家贡献代码
·
Manus重磅发布:全球首款通用AI代理技术深度解析与实战指南
·
被坑几百块钱后,我竟然真的恢复了删除的微信聊天记录!
·
AI技术革命,工作效率10个最佳AI工具
昵称:
AtlasLapetos
园龄:
3年
粉丝:
0
关注:
2
+加关注
<
2025年3月
>
日
一
二
三
四
五
六
23
24
25
26
27
28
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
1
2
3
4
5
搜索
常用链接
我的随笔
我的评论
我的参与
最新评论
我的标签
随笔分类
LVGL(61)
计算机网络(1)
开放平台(123)
微信小程序 - 安全(19)
微信小程序 - 介绍(8)
微信小程序 - 开发(2120)
微信小程序 - 设计(3)
微信小程序 - 数据(35)
微信小程序 - 运营(257)
小程序开发指南(3)
随笔档案
2025年2月(562)
2025年1月(1462)
2024年12月(623)
2024年11月(2)
文章分类
AWTK(202)
C++(95)
DolphinHybrid(307)
Flutter(222)
Found(15)
go(27)
JavaScript(113)
Linux(30)
MeiOS(412)
MiniX自绘渲染跨平台框架(322)
python(75)
weex(69)
开发工具(42)
美的IoT开发者平台(60)
设计模式(34)
数据结构与算法(33)
数据库(175)
物联网平台(26)
小程序开发框架(93)
协议(51)
正则表达式(8)
阅读排行榜
1. 用户隐私保护指引填写说明(507)
2. 小程序用户隐私保护指引内容介绍(349)
3. wx.getSystemInfoSync(337)
4. 蓝牙低功耗 (Bluetooth Low Energy, BLE)(231)
5. 获取 URL Scheme(226)
点击右上角即可分享
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· 开发者必知的日志记录最佳实践
· SQL Server 2025 AI相关能力初探
· Linux系列:如何用 C#调用 C方法造成内存泄露
· AI与.NET技术实操系列(二):开始使用ML.NET
· 记一次.NET内存居高不下排查解决与启示
· 阿里最新开源QwQ-32B,效果媲美deepseek-r1满血版,部署成本又又又降低了!
· 开源Multi-agent AI智能体框架aevatar.ai,欢迎大家贡献代码
· Manus重磅发布:全球首款通用AI代理技术深度解析与实战指南
· 被坑几百块钱后,我竟然真的恢复了删除的微信聊天记录!
· AI技术革命,工作效率10个最佳AI工具