32 lines
832 B
Vue
32 lines
832 B
Vue
<template>
|
|
<div class="content">
|
|
<tiny-file-upload ref="uploadRef" :action="action" :file-list="fileList">
|
|
<tiny-button type="primary">点击上传</tiny-button>
|
|
</tiny-file-upload>
|
|
<br />
|
|
<tiny-button @click="cancelUpload" type="primary">点击清空上传列表</tiny-button>
|
|
</div>
|
|
</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 fileList = ref([
|
|
{
|
|
name: 'test1',
|
|
url: `${import.meta.env.VITE_APP_BUILD_BASE_URL}static/images/fruit.jpg`
|
|
},
|
|
{
|
|
name: 'test2',
|
|
url: `${import.meta.env.VITE_APP_BUILD_BASE_URL}static/images/book.jpg`
|
|
}
|
|
])
|
|
const uploadRef = ref()
|
|
|
|
function cancelUpload() {
|
|
uploadRef.value.clearFiles()
|
|
}
|
|
</script>
|