Skip to content

zs-upload-image 图片上传组件

功能描述

专门用于上传图片的组件。

属性

属性名类型说明
v-modelstring绑定的图片URL
shapestring头像形状,可选值为 circlesquare

事件

事件名说明参数
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>