Appearance
InputView 输入框
模板标签:<qtx-input-view>
原生输入框,支持占位符、密码类型、状态配色、尺寸档位、光标控制与尾部图标。
<qtx-input-view> 由 Android @QtComponent 原生视图 + Vue 透传壳提供。完整 API 见下文「API 参考」与独立 API 页。
适用场景
- TV 上的搜索 / 登录输入
- 需要 error / success 状态边框
- 沿用系统软键盘(useSystemKeyboard 默认 true)
不适用场景
- 需要自定义键盘布局,用 qtx-keyboard
- 多行富文本编辑
Web 演示
Web 演示浏览器模拟演示 · TV 真机行为以实机为准
当前值:(空) · 核心能力:占位提示、状态配色、密码输入、尺寸档位。
最近事件:—
示例
vue
<template>
<div class="page" :width="1920" :height="1080">
<qtx-input-view text="示例文本" inputSize="large" :cursorVisible="true" />
</div>
</template>
<script setup lang="ts">
// QtxInputView 最小可运行示例;属性名来自 js/qtx/src/components/QtxInputView/QtxInputView.vue,
// 完整属性表见 ./api(由 npm run docs:gen 生成,禁止手写)。
</script>示例是仓库里真实的 .vue 文件,npm run docs:check 会用 qtx-tpl-loader 逐个编译,禁止占位写法。
使用约束与易错点
- type 仅 text / password,status 仅 normal / error / success,inputSize 仅 small / medium / large,其它值按默认处理
- cursorVisible 只在输入框已聚焦时生效,未聚焦时原生强制隐藏光标
- disabled 会同时关掉 focusable 与 focusableInTouchMode
已知边界
- useSystemKeyboard 默认 true,改用 qtx 自定义键盘时需显式关掉
- trailingIcon 为空字符串时隐藏图标
- onInputClick / onChange 是原生派发事件,Vue 层只做转发
验证状态
当前该组件由文档编译门禁覆盖;组件级真机断言与回归口径见 验证体系。
API 参考
以下表格由
npm run docs:gen从源码生成,禁止手工编辑;完整独立页见 InputView 输入框 API。
属性(Props · 9)
| 属性名 | 类型 | 必填 | 默认值 | 说明 | 事实源 |
|---|---|---|---|---|---|
cursorVisible | boolean | 否 | - | 输入框聚焦时是否显示光标 | vue-sfc+java |
disabled | boolean | 否 | false | 是否禁用输入与聚焦,默认 false | vue-sfc+java |
inputSize | 'large' | 'medium' | 'small' | 否 | - | 输入框尺寸档位:small / medium(默认)/ large,影响高度与字号 | vue-sfc+java |
placeholder | string | 否 | - | 输入为空时显示的占位提示文本 | vue-sfc+java |
status | string | 否 | - | 输入框状态:normal(默认)/ error / success,驱动边框与焦点配色 | vue-sfc+java |
text | string | 否 | - | 输入框当前文本 | vue-sfc+java |
trailingIcon | string | 否 | - | 输入框尾部图标的 URL 或本地路径,为空时隐藏图标 | vue-sfc+java |
type | string | 否 | - | 输入类型:text(默认)或 password,password 时启用密码输入变体 | vue-sfc+java |
useSystemKeyboard | boolean | 否 | true | 是否使用系统软键盘,默认 true | vue-sfc+java |
事件(Events · 2)
| 事件名 | 载荷参数 | 说明 | 事实源 |
|---|---|---|---|
@onChange | payload?: any | 是否使用系统软键盘,默认 true | vue-sfc+java |
@onInputClick | payload?: any | 是否使用系统软键盘,默认 true | vue-sfc+java |
方法(Methods / Expose · 1)
| 方法名 | 参数 | 返回值 | 说明 | 事实源 |
|---|---|---|---|---|
getNativeNode | — | — | - | vue-sfc |
插槽(Slots · 1)
| 插槽名 | 说明 | 事实源 |
|---|---|---|
default | 默认内容插槽,承载组件子内容 | js/qtx/src/components/QtxInputView/QtxInputView.vue |