Skip to content

InputSelect

基础用法

账单金额
请选择币种

<template>
  <ai-form ref="formEl" :model="formInfo" :formConfig="formConfig"></ai-form>
</template>

<script setup>
import { reactive, computed } from 'vue'

const CurrencyList = [
  { dictLabel: 'CNY', dictKey: 'CNY' },
  { dictLabel: 'USD', dictKey: 'USD' },
  { dictLabel: 'EUR', dictKey: 'EUR' }
]

const formInfo = reactive({
  billAmount: '',
  currency: ''
})

const formConfig = computed(() => {
  return [
    {
      key: 'billAmount',
      label: '账单金额',
      type: 'input-select',
      model: 'billAmount',
      prop: 'billAmount',
      required: true,
      appendModel: 'currency',
      appendPlaceholder: '请选择币种',
      dictList: CurrencyList
    },
  ]
})
</script>

Props

属性说明类型默认值
typeinput-selectstring-
key配置列表唯一标识string-
label标签文本string-
model属性名,它可以是属性的路径(如a.b.0)也可以是一个方法,返回属性路径,该属性是必填的string/Function-
prop一般和属性名保持一致,在使用了validateresetFields的方法时,该属性是必填的string/Function-
width宽度(1-24)number12
noneLabel是否隐藏标签booleanfalse
placeholder输入框占位文本string-
disabled是否禁用boolean/Functionfalse
size输入框尺寸string-
required是否必填booleanfalse
minLength最小长度校验number-
maxLength最大长度校验number-
min原生属性,设置最小值number-
max原生属性,设置最大值number-
regExp自定义正则校验string-
regMsg自定义正则校验错误信息string-
validator自定义校验方法Function-
appendModel后置筛选框modelstring-
appendProp后置筛选框propstring-
appendPlaceholder后置筛选框占位文本string-
prependModel前置筛选框modelstring-
prependProp前置筛选框propstring-
prependPlaceholder前置筛选框占位文本string-
showErrorTooltip是否展示错误提示booleantrue
changeFun当绑定值变化时触发的回调函数Function-
showFun是否展示的判断函数,返回一个booleanFunction-

后置和前置输入框其它属性可参考Select