|
@@ -1,6 +1,13 @@
|
|
|
<template>
|
|
|
<div class="header">
|
|
|
- <a-upload accept="image/*" name="file">
|
|
|
+ <a-upload
|
|
|
+ v-model:file-list="list"
|
|
|
+ accept="image/*"
|
|
|
+ multiple
|
|
|
+ :beforeUpload="beforeUpload"
|
|
|
+ :showUploadList="false"
|
|
|
+ name="file"
|
|
|
+ >
|
|
|
<a-button
|
|
|
v-if="butText"
|
|
|
@click="addImage"
|
|
@@ -110,6 +117,7 @@ const props = defineProps({
|
|
|
type: Array,
|
|
|
},
|
|
|
coverType: {
|
|
|
+ //列表显示的类型
|
|
|
type: String,
|
|
|
default: "thumbnail",
|
|
|
},
|
|
@@ -119,9 +127,14 @@ const props = defineProps({
|
|
|
default: false,
|
|
|
},
|
|
|
startSequence: {
|
|
|
+ //设置排序的起量,比如说第二页每页20条数据 起量为21
|
|
|
type: [String, Number],
|
|
|
default: 0,
|
|
|
},
|
|
|
+ total: {
|
|
|
+ //考虑分页情况传递,上传图片顺序会在此向后顺延
|
|
|
+ type: [Number, String],
|
|
|
+ },
|
|
|
});
|
|
|
|
|
|
let baseSize = ref("140"),
|
|
@@ -173,6 +186,7 @@ function handleDeleteImage(linksids = [], setSequence = true) {
|
|
|
console.log("删除图片", res);
|
|
|
utils.message(res, "操作成功", async () => {
|
|
|
list.value = list.value.filter((v) => !linksids.includes(v.linksid));
|
|
|
+ //如果考虑分页情况再这个节点去重新获取数据 setSequence=false
|
|
|
if (setSequence) await setSequenceAll();
|
|
|
});
|
|
|
resolve(res.code == 1);
|
|
@@ -232,6 +246,12 @@ function handleHoverChange(visible, index) {
|
|
|
if (prohibitHovered) return (hovered.value = null);
|
|
|
hovered.value = visible ? index : null;
|
|
|
}
|
|
|
+
|
|
|
+/* 文件上传 */
|
|
|
+function beforeUpload(file) {
|
|
|
+ console.log("file", file.name);
|
|
|
+ return false;
|
|
|
+}
|
|
|
</script>
|
|
|
|
|
|
<style scoped>
|