feat: listType参数

This commit is contained in:
2023-09-14 13:11:13 +08:00
parent 472d46049b
commit c306d6bb35

View File

@ -1,8 +1,8 @@
<!--
* @Author: zhaojinfeng 121016171@qq.com
* @Date: 2023-08-16 17:33:41
* @LastEditors: peerless_hero peerless_hero@outlook.com
* @LastEditTime: 2023-08-30 15:24:13
* @LastEditors: zhaojinfeng 121016171@qq.com
* @LastEditTime: 2023-09-14 12:57:29
* @FilePath: \vue3\packages\upload-list\index.vue
* @Description:
*
@ -14,12 +14,16 @@
:disabled="disabled"
:before-upload="beforeUpload"
:http-request="httpRequest"
:list-type="listType"
@preview="preview"
@success="success"
@remove="remove"
>
<slot>
<el-button type="primary" plain :disabled="disabled">
<el-icon v-if="listType === 'picture-card'">
<Plus />
</el-icon>
<el-button v-else type="primary" plain :disabled="disabled">
点击上传
</el-button>
</slot>
@ -27,6 +31,7 @@
</template>
<script lang="ts" setup name="ThUploadList">
import { Plus } from '@element-plus/icons-vue'
import type { UploadFile, UploadFiles, UploadRawFile, UploadRequestOptions, UploadUserFile } from 'element-plus'
const props = withDefaults(
@ -43,6 +48,8 @@ const props = withDefaults(
disabled?: boolean
/** 最大上传大小Mb */
maxsize?: number
/** 文件列表的类型 */
listType?: 'text' | 'picture' | 'picture-card'
}>(), {
fileList: () => [],
maxsize: 100,