输入框支持删除功能的组件
效果
使用方法
<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 'lighting-ui/packages/lc-textfield';
import Category from 'lighting-ui/packages/_mods/category.vue';
import Title from 'lighting-ui/packages/_mods/title.vue';
export default {
components: { Title, Category, LcTextfield },
data: () => ({
value1: '12312',
}),
watch:{
value1(newVal, oldVal){
console.log(newVal, oldVal);
}
}
};
</script>
可配置参数
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
绑定可获取输入内容
事件回调
@onInput="onInput"
@onChange="onChange"
@onBlur="onBlur"
@onFocus="onFocus"
@onEnter="onEnter"