kui-vue
Version:
A lightweight desktop UI component library suitable for Vue.js 2.
34 lines (32 loc) • 672 B
Markdown
<cn>
### 上传头像
limit等于上传文件数量时, 则不显示选择文件组件,
</cn>
```vue
<template>
<Upload
action="https://www.chuchur.com/api/upload/image"
name="file"
type="picture"
:headers="headers"
@change="handleChange"
:limit="1"
accept="image/*"
:uploadIcon="CameraOutline"
uploadText="上传头像"
>
</Upload>
</template>
<script setup>
import { CameraOutline } from "kui-icons";
import { ref } from "vue";
const headers = ref({
authorization: "here is token",
});
const handleChange = (info) => {
if (info.file.status !== "uploading") {
console.log(info.file, info.fileList);
}
};
</script>
```