hae
Version:
Mobile web UI based on Vux
160 lines (159 loc) • 5.06 kB
YAML
category:
en: Form
'zh-CN': 表单
icon: ''
tags:
en:
- form
- search
zh-CN:
- 表单
- 搜索
props:
placeholder:
default: 搜索(search)
en: placeholder text
zh-CN: 提示文字
cancel-text:
default: 取消(cancel)
en: cancel text
zh-CN: 取消文字
value:
en: input value, use `v-model` for binding
zh-CN: 表单值,`v-model`绑定
results:
type: Array
en: "search results, [{title: 'hello', otherData: otherValue}], will not show when auto-fixed is false"
zh-CN: "指定搜索结果, 为带有 title key 的对象组成的数组,如 [{title: 'hello', otherData: otherValue}], auto-fixed 为 false 时不会显示结果"
auto-fixed:
type: Boolean
default: true
en: if auto fixed on top when input gets focus
zh-CN: 是否自动固定在顶端
top:
type: String
default: '0px'
en: top value when fixed on top
zh-CN: 自动固定时距离顶部的距离
position:
type: String
default: 'fixed'
en: position value when pin the component on the top, one of `fixed`, `absolute`
zh-CN: '自动固定时的定位,一些布局下可能需要使用其他定位,比如`absolute`'
auto-scroll-to-top:
type: Boolean
default: false
en: if auto scroll to top when input gets focus
zh-CN: '`Safari`下弹出键盘时可能会出现看不到input,需要手动滚动,启用该属性会在fix时滚动到顶端'
events:
on-submit:
params: '`(value)`'
en: emits when form is submitted
zh-CN: 表单提交时触发
on-cancel:
en: emits when cancel button is clicked
zh-CN: '点击`取消`按钮时触发'
on-change:
params: '`(value)`'
en: emits when value is changed
zh-CN: 输入文字变化时触发
on-result-click:
params: '`(item)`'
en: emits when result item is clicked
zh-CN: '点击结果条目时触发,原来的`result-click`事件不符合规范已经废弃'
on-focus:
version: v2.1.1-rc.10
en: when input gets focus
zh-CN: 输入框获取到焦点时触发
on-blur:
version: v2.6.3
en: fires when input losts focus
zh-CN: 输入框失去焦点时触发
on-clear:
version: v2.9.0
en: fires when clicking clear icon
zh-CN: 点击清除按钮时触发
slots:
default:
en: slot above search result
zh-CN: 搜索结果列表上面 slot,可以用来自定义搜索结果显示区域(results 设为空)
right:
en: slot on the right of input
zh-CN: 输入框右侧 slot
left:
version: v2.3.5
en: slot on the left of input
zh-CN: 输入框左侧 slot
methods:
setFocus:
en: "set focus on input. you should call this method in a click event's callback function on Safari"
zh-CN: 获取 input 焦点,在 Safari 上你必须在 click 事件回调里使用才能生效
setBlur:
version: v2.3.6
en: make input lost focus
zh-CN: 手动设置 input 失去焦点,一般用于在 on-submit 事件中实现隐藏手机键盘
changes:
v2.9.0:
en:
- '[feature] add event:on-clear #2251'
zh-CN:
- '[feature] 添加事件 on-clear #2251'
2.7.6:
en:
- '[fix] fix not emit on-change and input events when cancel or clear'
zh-CN:
- '[fix] 修复 在 cancel 或 clear 时没有触发 on-change 和 input 事件'
v2.7.3:
en:
- '[fix] fix event:on-change fires before compositionend'
zh-CN:
- '[fix] 修复输入法导致 on-change 事件提前触发'
v2.6.3:
en:
- '[feature] add event:on-blur'
zh-CN:
- '[feature] 添加事件 on-blur'
v2.3.6:
en:
- '[feature] Add method:setBlur'
zh-CN:
- '[feature] 添加方法 setBlur'
v2.3.5:
en:
- '[feature] Add slot:left'
zh-CN:
- '[feature] 增加 slot:left'
v2.2.2:
en:
- '[enhance] Show search text on iOS keyboard'
zh-CN:
- '[enhance] 在 iOS 键盘上显示 search'
v2.2.0:
en:
- '[enhance] emit on-change after input'
zh-CN:
- '[enhance] 在 input 后触发 on-change 事件(否则此时 v-model 绑定的值和参数不一致)'
v2.1.1-rc.13:
en:
- '[feature] Add slot:right'
zh-CN:
- '[feature] 添加 slot=right'
v2.1.1-rc.12:
en:
- '[enhance] do not emit on-change is isCancel = true'
zh-CN:
- '[enhance] 点击取消按钮后不再触发 on-change 事件'
v2.1.1-rc.10:
en:
- '[feature] Add event on-focus'
zh-CN:
- '[feature] 支持 on-focus 事件'
v2.1.0:
zh-CN:
- '[feature] 更新到`WeUI`最新代码'
- '[enhance] 当`value`为空时,不显示清除按钮'
v2.1.0-rc.47:
zh-CN:
- '[enhance] 删除无用代码'
- '[fix] 修复`取消`按钮在非`fixed`情况下没有出现的问题 @excitedcat'
- '[fix] 修复页面上多个实例时,`label id`冲突'