Browse Source

上传文件

master
maochaoying 2 years ago
parent
commit
5f88952ebf
  1. 2
      .env
  2. 29
      src/components/Upload.vue
  3. 1
      src/main.js
  4. 8
      src/pages/index.vue
  5. 129
      src/static/css/reset.css

2
.env

@ -1 +1 @@
VITE_BASE_URL=http://127.0.0.1:8080/
VITE_BASE_URL=http://127.0.0.1:8899/

29
src/components/Upload.vue

@ -0,0 +1,29 @@
<template>
<div class="upload_container">
<div style="width: 350px">
<t-upload
action="http://127.0.0.1:8899/upload"
:tips="tips"
v-model="files"
@fail="handleFail"
@success="onSuccess"
status="success"
theme="file-input"
placeholder="未选择文件"
accept="application/vnd.ms-excel,application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"
></t-upload>
</div>
</div>
</template>
<script setup>
import { ref } from 'vue'
const files = ref([])
const tips = ref('上传格式仅支持xls、xlsx')
const handleFail = ({ file }) => {}
const onSuccess = () => {
tips.value = ''
}
</script>
<style lang="scss" scoped></style>

1
src/main.js

@ -5,5 +5,6 @@ import App from './App.vue'
import TDesign from 'tdesign-vue-next'
import 'tdesign-vue-next/es/style/index.css'
import './style.scss'
import '@/static/css/reset.css'
createApp(App).use(router).use(store).use(TDesign).mount('#app')

8
src/pages/index.vue

@ -1,8 +1,12 @@
<template>
<div class="home_container"><t-button>确定</t-button></div>
<div class="home_container">
<Upload />
</div>
</template>
<script setup></script>
<script setup>
import Upload from 'cpns/Upload'
</script>
<style lang="scss" scoped>
.home_container {

129
src/static/css/reset.css

@ -0,0 +1,129 @@
/* http://meyerweb.com/eric/tools/css/reset/
v2.0 | 20110126
License: none (public domain)
*/
html,
body,
div,
span,
applet,
object,
iframe,
h1,
h2,
h3,
h4,
h5,
h6,
p,
blockquote,
pre,
a,
abbr,
acronym,
address,
big,
cite,
code,
del,
dfn,
em,
img,
ins,
kbd,
q,
s,
samp,
small,
strike,
strong,
sub,
sup,
tt,
var,
b,
u,
i,
center,
dl,
dt,
dd,
ol,
ul,
li,
fieldset,
form,
label,
legend,
table,
caption,
tbody,
tfoot,
thead,
tr,
th,
td,
article,
aside,
canvas,
details,
embed,
figure,
figcaption,
footer,
header,
hgroup,
menu,
nav,
output,
ruby,
section,
summary,
time,
mark,
audio,
video {
margin: 0;
padding: 0;
border: 0;
font-size: 100%;
font: inherit;
vertical-align: baseline;
}
/* HTML5 display-role reset for older browsers */
article,
aside,
details,
figcaption,
figure,
footer,
header,
hgroup,
menu,
nav,
section {
display: block;
}
body {
line-height: 1;
}
ol,
ul {
list-style: none;
}
blockquote,
q {
quotes: none;
}
blockquote:before,
blockquote:after,
q:before,
q:after {
content: '';
content: none;
}
table {
border-collapse: collapse;
border-spacing: 0;
}
Loading…
Cancel
Save