<v-btn
class="ml-3"
depressed
color="primary"
style="position:relative;"
>
<v-file-input
@change="uploadFile"
accept=".xls, .xlsx"
style="position:absolute;z-index:999;width: 200px;height:66px;flex: none; background: none;opacity:0"
></v-file-input>
<v-icon class="pr-1">mdi-database-import-outline</v-icon>
{{ $t("application.Import SubApplication") }}
</v-btn>
uploadFile(value) {
let formData = new FormData();
formData.append("file", value);
this.loading = true;
this.$http
.post(
`api/${this.$route.params.id}/account/import`,
formData
)
.delegateTo(api_request)
.then(() => {
this.refreshList();
this.loading = false;
return "导入账户成功";
})
.catch(({ code, message }) => {
this.loading = false;
throw `导入账户失败:${this.$t("api." + code)}, 额外信息: ${this.$t(
"api." + typeof message === "string"
? message
: JSON.stringify(message)
)}`;
})
.delegateTo(this.$snackbar.delegateError);
},
Vuetify—— 上传按钮布局
最新推荐文章于 2023-10-22 22:49:16 发布