perf:支持上传多篇文章
This commit is contained in:
@@ -212,6 +212,13 @@ const catalogueData = ref([]);
|
||||
|
||||
// 面包屑导航列表
|
||||
const breadcrumbsList = ref([]);
|
||||
const resultRouters = ["index", "discuss", "themeCover"];
|
||||
breadcrumbsList.value = route.matched[0].children
|
||||
.filter((item) => resultRouters.includes(item.name))
|
||||
.sort((a, b) => {
|
||||
return resultRouters.indexOf(a.name) - resultRouters.indexOf(b.name);
|
||||
});
|
||||
|
||||
// 当前文章名称
|
||||
const currentArticle = ref("");
|
||||
|
||||
@@ -239,6 +246,7 @@ const loadDiscuss = async (isRewrite) => {
|
||||
const response = await articleGet(route.params.articleId);
|
||||
discuss.value.content = response.data.content;
|
||||
}
|
||||
breadcrumbsList.value[1].path = "/discuss/" + discuss.value.plateId;
|
||||
ContentHander();
|
||||
};
|
||||
//加载文章及目录
|
||||
@@ -362,12 +370,6 @@ onMounted(async () => {
|
||||
await loadArticleData();
|
||||
});
|
||||
|
||||
const resultRouters = ["index", "discuss", "themeCover"];
|
||||
breadcrumbsList.value = route.matched[0].children
|
||||
.filter((item) => resultRouters.includes(item.name))
|
||||
.sort((a, b) => {
|
||||
return resultRouters.indexOf(a.name) - resultRouters.indexOf(b.name);
|
||||
});
|
||||
watch(
|
||||
() => currentArticle.value,
|
||||
(val) => {
|
||||
|
||||
@@ -107,7 +107,13 @@
|
||||
</div>
|
||||
<!-- 文件弹框 -->
|
||||
<div>
|
||||
<input v-show="false" ref="fileRef" type="file" @change="getFile" />
|
||||
<input
|
||||
v-show="false"
|
||||
ref="fileRef"
|
||||
type="file"
|
||||
multiple
|
||||
@change="getFile"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
@@ -317,15 +323,17 @@ const typeOptions = [
|
||||
const getFile = async (e) => {
|
||||
importLoading.value = true;
|
||||
try {
|
||||
let formDate = new FormData();
|
||||
formDate.append("file", e.target.files[0]);
|
||||
let formData = new FormData();
|
||||
for (let i = 0; i < e.target.files.length; i++) {
|
||||
formData.append("file", e.target.files[i]);
|
||||
}
|
||||
await importArticle(
|
||||
{
|
||||
discussId: route.query.discussId,
|
||||
articleParentId: route.query.parentArticleId,
|
||||
importType: currentType.value,
|
||||
},
|
||||
formDate
|
||||
formData
|
||||
);
|
||||
ElMessage({
|
||||
message: `导入成功!`,
|
||||
|
||||
Reference in New Issue
Block a user