0.0.19 • Published 3 years ago

@retailwe/ui-textarea v0.0.19

Weekly downloads
-
License
-
Repository
-
Last release
3 years ago

textarea 标签

引入

全局引入,在miniprogram根目录下的app.json中配置,局部引入,在需要引入的页面或组件的index.json中配置。

// app.json 或 index.json
"usingComponents": {
  "wr-textarea": "@retailwe/ui-textarea/index"
}

代码演示

基础用法

<wr-textarea
  placeholder="请输入内容"
  bindinput="onInput"
></wr-textarea>
Page({
  data: {
    value: '',
  },
  onInput(e: any) {
    const { index } = e.currentTarget.dataset;
    const { value } = e.detail;
    this.setData({
      'value': value,
    });
  },
});

带边框

<wr-textarea
  placeholder="请输入内容"
  border
  bindinput="onInput"
></wr-textarea>

限制内容长度

<wr-textarea
  placeholder="请输入内容"
  border
  maxlength="10"
  show-count
  bindinput="onInput"
></wr-textarea>

高度自适应

<wr-textarea
  placeholder="请输入内容"
  border
  auto-height
  bindinput="onInput"
></wr-textarea>

API

Props

以下属性会透传至原生textarea type, showConfirmBar, adjustPosition, value, placeholder, maxlength, focus, disabled,

参数说明类型默认值版本
showCount是否显示字数统计,仅maxlength大于-1时有效numberfalse-
border是否显示边框和内边距,默认无边距无边框booleanfalse-
value已输入的文本内容string--
placeholdervalue为空时的占位内容string--
maxlength内容最大长度,-1代表不做限制number-1-
type请参考原生textarea的type属性number-1-
showConfirmBar软件盘上是否显示完成按钮booleantrue-
autoFocus自动获取焦点booleanfalse-
focus是否获取焦点booleanfalse-
adjustPosition键盘弹起时是否自动上推页面booleantrue-
cursorSpacing键盘弹起时组件底部与键盘的距离,请参考原生textarea的type属性number0-
disabled是否禁用组件booleanfalse-
autoHeight是否开启高度自适应booleanfalse-

Event

事件名说明参数
input输入内容变化时触发{ value }
confirm点击键盘上的完成按钮时触发{ value }
focus获取焦点时触发, height为键盘高度{ value, height }
blur失去焦点时触发, cursor为游标位置{ value, cursor }

外部样式类

类名说明
wr-class根节点外部样式类
wr-class-placeholder预设内容外部样式类
0.0.19

3 years ago

0.0.18

4 years ago

0.0.17

4 years ago

0.0.16

4 years ago

0.0.15

4 years ago

0.0.14

4 years ago

0.0.13

4 years ago

0.0.12

4 years ago

0.0.11

4 years ago

0.0.10

4 years ago

0.0.9

4 years ago

0.0.8

4 years ago

0.0.7-beta.1

4 years ago