tiny-vue/examples/sites/demos/pc/app/file-upload/custom-upload-tip-compositi...

19 lines
688 B
Vue
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<template>
<tiny-file-upload ref="uploadRef" :action="action" accept=".jpg,.png" re-uploadable :re-upload-tip="reUploadTip">
<template #trigger>
<tiny-button type="primary">选取文件</tiny-button>
</template>
<template #tip>
<div class="tiny-upload__tip">只能上传 jpg/png 文件且不超过500 kb</div>
</template>
</tiny-file-upload>
</template>
<script setup>
import { ref } from 'vue'
import { FileUpload as TinyFileUpload, Button as TinyButton } from '@opentiny/vue'
const action = ref('http://localhost:3000/api/upload')
const reUploadTip = (count) => `我是自定义重新上传的左侧提示,${count}个文件变红啦!`
</script>