输入框

基础用法

  • 示例:
点击查看代码
<template>
  <z-input v-model:value="value" />
</template>
<script>
import { defineComponent, ref } from 'vue'

export default defineComponent({
  name: 'InputDemo1',
  setup(){
    const value = ref('')
    return {
      value
    }
  }
})
</script>

icon

  • 示例:
点击查看代码
<template>
  <z-input v-model:value="value1" prefix="" suffix="RMB" />
  <div style="margin: 24px 0" />
  <z-input v-model:value="value2">
    <template #prefix>
      <user-outlined />
    </template>
    <template #suffix>
      <info-circle-outlined />
    </template>
  </z-input>
</template>
<script>
import { defineComponent, ref } from 'vue'

export default defineComponent({
  name: 'InputDemo2',
  setup(){
    const value1 = ref('')
    const value2 = ref('')
    return {
      value1,
      value2
    }
  }
})
</script>

密码框

  • 示例:
点击查看代码
<template>
  <z-password v-model:value="value" />
</template>
<script>
import { defineComponent, ref } from 'vue'

export default defineComponent({
  name: 'InputDemo3',
  setup(){
    const value = ref('')
    return {
      value
    }
  }
})
</script>

文本域

  • 示例:
点击查看代码
<template>
  <z-textarea v-model:value="value" />
</template>
<script>
import { defineComponent, ref } from 'vue'

export default defineComponent({
  name: 'InputDemo4',
  setup(){
    const value = ref('')
    return {
      value
    }
  }
})
</script>

前置/后置标签

  • 示例:
点击查看代码
<template>
  <z-input v-model:value="value1" addon-before="Http://" addon-after=".com" />
  <div style="margin: 24px 0" />
  <z-input v-model:value="value2">
    <template #addonBefore>
      <star-outlined />
    </template>
    <template #addonAfter>
      <star-filled />
    </template>
  </z-input>
</template>
<script>
import { defineComponent, ref } from 'vue'

export default defineComponent({
  name: 'InputDemo5',
  setup(){
    const value = ref('')
    const value1 = ref('')
    const value2 = ref('')
    return {
      value1,
      value2
    }
  }
})
</script>

Input Props

参数说明类型默认值
value(v-model)输入框内容string---
placeholder提示语string---
id输入框的 idstring---
disabled是否禁用booleanfalse
maxlength最大长度number---
allowClear可以点击清除图标删除内容booleanfalse
addonAfter带标签的 input,设置后置标签string | slot---
addonBefore带标签的 input,设置前置标签string | slot---
bordered是否有边框booleantrue
defaultValue输入框默认内容string---
prefix带有前缀图标的 inputstring | slot---
suffix带有后缀图标的 inputstring | slot---

Input Event

事件说明回调参数
change输入框内容变化时的回调function(e)
pressEnter按下回车的回调function(e)

TextArea Props

参数说明类型默认值
value(v-model)输入框内容string---
autosize自适应内容高度,可设置为 true | false 或对象:{ minRows: 2, maxRows: 6 }boolean/objectfalse
defaultValue输入框默认内容string---
showCount是否展示字数提示booleanfalse
allowClear可以点击清除图标删除内容booleanfalse

TextArea Event

事件说明回调参数
pressEnter按下回车的回调function(e)

Search Props

参数说明类型默认值
enterButton是否有确认按钮,可设为按钮文字。该属性会与 addon 冲突boolean/slotfalse
loading搜索 loadingboolean---

Search Event

事件说明回调参数
search点击搜索或按下回车键时的回调function(value, event)

Password Props

参数说明类型默认值
visibilityToggle是否显示切换按钮booleantrue
Last Updated:
Contributors: jixuanyu