zs-upload-image 图片上传组件
功能描述
专门用于上传图片的组件。
属性
| 属性名 | 类型 | 说明 |
|---|---|---|
| v-model | string | 绑定的图片URL |
| shape | string | 头像形状,可选值为 circle 或 square |
事件
| 事件名 | 说明 | 参数 |
|---|---|---|
| changeSuccess | 头像上传成功时触发 | 上传成功的头像 URL |
使用示例
vue
<template>
<zs-upload-image
v-model="imageUrl"
@changeSuccess="handleChangeSuccess"
/>
</template>
<script lang="ts" setup>
import { ref } from 'vue';
import ZsUploadImage from '@/components/zs-upload-image';
const imageUrl = ref('');
const handleChangeSuccess = (url: string) => {
console.log('图片上传成功:', url);
imageUrl.value = url;
};
</script>