lighting-ui
Version:
A rich interaction, lightweight, high performance UI library based on Weex
89 lines (68 loc) • 1.93 kB
Markdown
# lc-numberfield
> 货币或数量输入框
### 规则
- 集成了显示货币单位,自动格式化功能
## [Demo](http://res.lightyy.com/lightui/example/numberfield/?_wx_tpl=http%3A%2F%2Fres.lightyy.com%2Flightui%2Fexample%2Fnumberfield%2Findex.native.js)
<img src="./numberfield.png" width="240"/>
<img src="./numberfield-scan.png" width="160">
## 使用方法
```vue
<template>
<div class="wxc-demo">
<title title="lc-numberfield"></title>
<div class="container">
<category title="普通输入"></category>
<div class="form">
<lc-numberfield type="number" placeholder="最小金额10元" maxlength=10 ></lc-numberfield>
</div>
<category title="显示货币"></category>
<div class="form">
<lc-numberfield type="number" :showIcon="true" placeholder="最小金额10元" maxlength=10 v-model="money"></lc-numberfield>
</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 { LcNumberfield } from '../../index';
import Title from '../_mods/title.vue';
import Category from '../_mods/category.vue';
export default {
components: { Title, Category, LcNumberfield },
data: () => ({
money: 200
}),
created () {
},
methods: {
},
watch:{
money(newVal, oldVal){
console.log(newVal, oldVal);
}
}
};
</script>
```
### API
| Prop | Type | Required | Default | Description |
| ---- |:----:|:---:|:-------:| :----------:|
| **`showIcon`** | `String` | `N` | `text` | `是否显示货币图标` |
| **`placeholder`** | `String` | `N` | ` ` | `提示文本` |
| **`maxlength`** | `Number` | `N` | ` ` | `输入最大长度` |