# import
>[success] import hy\_ui.hy\_form.hy\_input
# extends
>[success] import hy\_ui.hy\_span.hy\_label;
# 構造函數
```
hy_input(Placeholder:String="請輸入",Color:String="default",Size:String="de",Icon:String="",startInit:Boolean=true)
```
```
pirvate var input:hy_input=new hy_input("請輸入");
this.addChild(input);
```
# 舞臺命名
>[danger] name【變量名】$verify【驗證】$placeholder【占位符】$disabled【禁用】
```
title$required_phone$請輸入標題$true
```
# 屬性
## baseType 基本類型
>[info] String \[ get \] `input`
## isField 是否表單元素
>[info] Boolean \[ get \] `true`
> 提交表單的時候一般先判斷
## color 顏色樣式
>[info] String | Object \[ set \] `default`
| 默認 | 主要 | 成功 | 信息 | 警告 | 危險 | 灰色 | 藍色 | 黑色 | 錯誤 |
| :---: | :---: | :---: | :---: | :---: | :---: | :---: | :---: | :---: | :---: |
| default | primary | success | info | warning | danger | gray | blue | black | error |
```
input.color="success"
```
## size 大小樣式
>[info] String | Object \[ set \] `de`
| | 迷你 | 小 | 默認 | 大 | 超大 |
| :---: | :---: | :---: | :---: | :---: | :---: |
| 屬性 | xs | sm | de | lg | slg |
| 字體 | 12 | 12 | 14 | 18 | 30 |
| 高度 | 20 | 28 | 36 | 42 | 54 |
```
input.size="sm"
```
## width 寬度
>[info] Number \[ get | set \] `36*4`
> 如果不設置,通過size 自動變化
```
input.width=300
```
## height 高度
>[info] Number \[ get | set \] `36`
> 如果不設置,通過size 自動變化
```
input.height=100
```
## disabled 禁用
>[info] Boolean \[ get | set \] `false`
```
input.disabled=true//禁用
```
## align 中心對齊方式
>[info] String \[ get | set \] `top_left`
| 上下 | 左右 |
| :---: | :---: |
| top , center , bottom | left , center , right |
```
input.align="top_center"
```
## text 文字
>[info] String \[ get | set \] `""`
```
input.text="標題內容"
```
## value 文字
>[info] String \[ get | set \] `""`
> 和text一樣
## embedFonts 字體嵌套
>[info] Boolean \[ set \] `false`
```
input.embedFonts=true
```
## error 錯誤提示
>[info] Boolean \[ set \] `false`
> 提交表單時候,如果有錯誤, 邊框顏色變紅
```
input.error=true
```
## readOnly 只讀
>[info] Boolean \[ get | set \] `false`
```
input.readOnly=true
```
## placeholder 占位符
>[info] String \[ public \] `請輸入`
```
input.placeholder="請輸入電話"
```
## verify 驗證
>[info] String \[ public \] \`\`
| 必填 | 電話 | 郵件 | 鏈接 | 日期 | 身份證 | 密碼 | 數字 | 正整數 |
| :---: | :---: | :---: | :---: | :---: | :---: | :---: | :---: | :---: |
| required | phone | email | url | date | identity | password | hyInt0 | hyInt|
```
input.verify="required|phone"//必填|電話
```
## icon 圖標
>[info] String \[ set \] `""`
```
input.icon="search"
```
## showBorder 顯示邊框
>[info] Boolean \[ set \] `true`
```
input.showBorder=false
```
# 監聽
## submit
>[info] 監聽回車
```
input.on("submit",function(value,oThis))
```