更新记录
1.0.0(2025-12-26)
下载此版本
master
平台兼容性
uni-app(4.13)
| Vue2 |
Vue3 |
Chrome |
Safari |
app-vue |
app-nvue |
Android |
iOS |
鸿蒙 |
| √ |
√ |
√ |
√ |
√ |
- |
√ |
√ |
√ |
| 微信小程序 |
支付宝小程序 |
抖音小程序 |
百度小程序 |
快手小程序 |
京东小程序 |
鸿蒙元服务 |
QQ小程序 |
飞书小程序 |
快应用-华为 |
快应用-联盟 |
| √ |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
其他
安装
在市场导入xf-fielduni_modules版本的即可,无需import
组件关联说明
代码演示
插件使用
基本用法
<template>
<view class=" xf-full-height">
<view class="filed-cell xf-row-center xf-row xf-full-width">
<text>单行文本输入:</text>
<xf-field class="xf-full-flex" v-model="text1" placeholder="请输入"
:adjustPosition="false" :maxlength="10" inputAlign="right"
:autoHeigh="false" @change="change"></xf-field>
</view>
<view class="textarea-cell xf-col">
<text>多行文本输入:</text>
<xf-field style="margin-top: 10px;" height="160" v-model="text2" placeholder="请输入"
:adjustPosition="true" :maxlength="1000" isTextarea
:autoHeigh="false" @change="change"></xf-field>
</view>
</view>
</template>
<script setup lang="ts">
import { ref } from 'vue';
const text1 = ref('');
const text2 = ref('');
const change = (e) => {
console.log(e)
}
</script>
API
Props
| 属性名 |
说明 |
类型 |
默认值 |
| v-model:modelValue |
当前输入的值 |
string |
- |
| disabled |
是否禁用输入框 |
boolean |
false |
| type |
输入框类型 |
number|text|digit|tel|safe-password |
text |
| isTextarea |
是多行文本还是单行文本 |
boolean |
false |
| customStyle |
单行文本时定义需要用到的外部样式 |
string |
取消 |
| placeholder |
输入框为空时占位符 |
string |
请输入 |
| maxlength |
最大输入长度,设置为 -1 的时候不限制最大长度 |
number |
- |
| fontSize |
字体大小 |
number |
16 |
| inputAlign |
输入框内容对齐方式 |
left|right |
- |
| autoHeight |
多行文本输入高度自适应 |
boolean |
true |
| adjustPosition |
键盘弹起时,是否自动上推页面 |
boolean |
true |
| height |
多行文本默认高度 |
number |
70 |
事件 Emits
| 事件名 |
说明 |
返回值 |
| change |
输入本文事件 |
|
| focus |
输入框聚焦时触发 |
|