0.1.1 • Published 5 years ago

giao-text v0.1.1

Weekly downloads
1
License
ISC
Repository
github
Last release
5 years ago

giao-text

小程序文本输入组件,高度自定义,可拓展性。

代码片段示例

导入代码片段 https://developers.weixin.qq.com/s/Sjal5pm87mfC

github https://github.com/oloshe/giao-text

快速开始

安装

npm i giao-text

添加引用

{
  "usingComponents": {
    "giao-text": "../../component/giao-text/index"
  }
}

基础用法

基础用法

<text-control stringSet="1234567890." placeholder="请输入内容"/>

自定义字符集

自定义字符集

<text-control stringSet="112,233,dds,566,#^@,dsd,<>?>,【】,55" separator="," placeholder="请输入内容"/>

自定义Slot

自定义Slot

<text-control id="custom" stringSet="123456789" columns="3" placeholder="请输入内容">
  <view slot="right" class="btn">确定</view>
</text-control>
<text-control id="custom" stringSet="123456789" columns="3" placeholder="请输入内容">
  <icon slot="left" class="icon" type="search" size="25" />
</text-control>

自定义按钮样式

自定义按钮样式

<text-control stringSet="1234567890" columns="5" btn-class="custom-btn" hover-class="custom-hover" collapse-class="collapse" collapseSlot placeholder="请输入内容">
    <icon slot="collapse" type="download" size="25" />
</text-control>

API

Props

参数说明类型默认值
string-set字符集String-
separator分隔符,用于分割stringSetString''
columns列数,每行的最大按钮个数Number6
distinct是否去重Booleanfalse
combo当前字符长度为2时,是否将光标移至中间,如"()" "[]"Booleanfalse
clearable是否显示清除按钮Booleanfalse
type可设置为任意原生类型, 如 number idcard textarea digitString'text'
password是否是密码类型Booleanfalse
maxlength最大长度,设置为-1为不限Number-1
random按钮是否随机分配位置(在每次输入框获取焦点时)Booleanfalse
keep按钮面板是否保持显示Booleanfalse
collapse-label收起按钮显示文本String'收起'
collapse-slot使用收起按钮slot时需设置此属性Booleanfalse
scroll是否为滚动显示(单行)Booleanfalse
hoverStayTime按钮点击态持续时间Number100
placeholder输入框为空时占位符String-
placeholder-style指定 placeholder 的样式String-
placeholder-class指定 placeholder 的样式类String-
disabled是否禁用Booleanfalse

输入框 API 参考 微信官方文档

Events

事件说明返回参数
bind:change内容改变事件value = event.detail
bind:input输入框输入事件,点击按钮不触发value = event.detail
bind:focus输入框获取焦点事件-
bind:blur输入框失去焦点事件-
bind:confirm点击完成按钮时触发value = event.detail.value
bind:keyboardheightchange键盘高度发生变化的时候触发此事件-

注:部分输入法由于输入时不主动触发input事件,所以会导致不好的体验

0.1.1

5 years ago

0.1.0

5 years ago

0.0.8

6 years ago

0.0.7

6 years ago

0.0.6

6 years ago

0.0.5

6 years ago

0.0.4

6 years ago

0.0.3

6 years ago

0.0.2

6 years ago

0.0.1

6 years ago