lighting-ui
Version:
A rich interaction, lightweight, high performance UI library based on Weex
90 lines (67 loc) • 1.93 kB
Markdown
# lc-textfield
> 支持删除内容输入域组件
### 规则
- 增加删除按钮功能的输入域
## [Demo](http://res.lightyy.com/lightui/example/textfield/?_wx_tpl=http%3A%2F%2Fres.lightyy.com%2Flightui%2Fexample%2Ftextfield%2Findex.native.js)
<img src="./textfield.png" width="240"/>
<img src="./textfield-scan.png" width="160">
## 使用方法
```vue
<template>
<div class="wxc-demo">
<title title="lc-textfield"></title>
<div class="container">
<category title="普通输入"></category>
<div class="form">
<lc-textfield type="number"></lc-textfield>
</div>
<category title="输入值监听"></category>
<div class="form">
<lc-textfield v-model="value1"></lc-textfield>
</div>
</div>
</div>
</template>
<style scoped>
.wxc-demo {
position: absolute;
top: 0;
bottom: 0;
left: 0;
right: 0;
background-color: #FFFFFF;
}
.container{
flex-direction: column;
align-items: center;
}
.form{
width: 600px;
}
</style>
<script>
import { LcTextfield } from '../../index';
import Title from '../_mods/title.vue';
import Category from '../_mods/category.vue';
export default {
components: { Title, Category, LcTextfield },
data: () => ({
value1: '12312',
}),
watch:{
value1(newVal, oldVal){
console.log(newVal, oldVal);
}
}
};
</script>
```
### API
| Prop | Type | Required | Default | Description |
| ---- |:----:|:---:|:-------:| :----------:|
| **`type`** | `String` | `N` | `text` | `输入框类型` |
| **`placeholder`** | `String` | `N` | ` ` | `提示文本` |
| **`disabled`** | `Boolean` | `N` | `false` | `是否禁用` |
| **`autofocus`** | `Boolean` | `N` | `false` | `是否自动聚焦` |
| **`maxlength`** | `Number` | `N` | ` ` | `输入最大长度` |
- *1:在`textfield`中使用`v-model`绑定可获取输入内容