UploadInput 上传文件
代码演示
基础用法
vue
<template>
<x-upload-input v-model="file"></x-upload-input>
</template>
<script setup>
import { ref } from 'vue'
const file = ref('')
</script>
<style lang="less" scoped>
.custom {
width: 240px;
height: 120px;
display: flex;
align-items: center;
justify-content: center;
border: @color-border dashed 1px;
cursor: pointer;
transition: all 0.15s;
&:hover {
border-color: @color-primary;
color: @color-primary;
}
}
</style>
API
参数
名称 | 说明 | 类型 | 默认值 |
---|---|---|---|
model-value(v-model) | string | - | |
text | 按钮内容 | string | 选择文件 |
loading-text | 上传中按钮内容 | string | 上传中 |
allow-clear | 允许清空 | boolean | true |
事件
名称 | 说明 | 返回值 |
---|---|---|
change | 内容发生改变 | modelValue |