Appearance
ImageSelector 图片选择器
简介
用于选择、预览、删除正反面图片,支持图片列表选择、预览大图、删除、切换等功能,常用于证件照等场景。
基本用法
vue
<template>
<g-image-selector v-model="imageValue" :src-list="imageList" />
</template>
<script setup>
import { ref } from 'vue'
const imageValue = ref({ frontImage: null, backImage: null })
const imageList = [{ url: 'https://example.com/1.jpg' }, { url: 'https://example.com/2.jpg' }]
</script>属性说明
| 属性 | 说明 | 类型 | 默认值 |
|---|---|---|---|
| modelValue | 绑定值(正反图片对象) | object | { frontImage: null, backImage: null } |
| srcList | 可选图片列表 | array | [] |
| showDelete | 是否显示删除按钮 | boolean | true |
事件
| 事件名 | 说明 | 回调参数 |
|---|---|---|
| update:modelValue | 绑定值变化时触发 | 新的图片对象 |
插槽
无。