|
@@ -11,18 +11,11 @@
|
|
|
@close="dialogClose"
|
|
|
>
|
|
|
<div class="infinite-list-wrapper" style="overflow: auto">
|
|
|
- <ul
|
|
|
- class="list"
|
|
|
- v-infinite-scroll="load"
|
|
|
- infinite-scroll-disabled="disabled"
|
|
|
- >
|
|
|
+ <ul class="list">
|
|
|
<li v-for="url in imageList" :key="url" style="margin-bottom: 10px">
|
|
|
<image-watermark :content="content" :url="url"></image-watermark>
|
|
|
</li>
|
|
|
</ul>
|
|
|
- <p v-if="loading">
|
|
|
- <i class="el-icon-loading"></i>
|
|
|
- </p>
|
|
|
</div>
|
|
|
<div slot="footer"></div>
|
|
|
</el-dialog>
|
|
@@ -46,21 +39,10 @@ export default {
|
|
|
data() {
|
|
|
return {
|
|
|
modalIsShow: false,
|
|
|
- sources: [],
|
|
|
imageList: [],
|
|
|
content: "",
|
|
|
- loading: false,
|
|
|
- pageSize: 2,
|
|
|
};
|
|
|
},
|
|
|
- computed: {
|
|
|
- noMore() {
|
|
|
- return this.sources.length === 0;
|
|
|
- },
|
|
|
- disabled() {
|
|
|
- return this.loading || this.noMore;
|
|
|
- },
|
|
|
- },
|
|
|
created() {
|
|
|
const { loginName, realName } = this.$ls.get("user", {});
|
|
|
this.content = `${realName}(${loginName})`;
|
|
@@ -82,18 +64,7 @@ export default {
|
|
|
async getAttachments() {
|
|
|
if (!this.attachmentIds || !this.attachmentIds.length) return;
|
|
|
const res = await attachmentPreview(this.attachmentIds);
|
|
|
- this.sources = (res || []).map((item) => item.url);
|
|
|
-
|
|
|
- if (this.sources.length) this.load();
|
|
|
- },
|
|
|
- load() {
|
|
|
- this.loading = true;
|
|
|
- const imgs = this.sources.splice(0, this.pageSize);
|
|
|
- this.imageList.push(...imgs);
|
|
|
-
|
|
|
- this.$nextTick(() => {
|
|
|
- this.loading = false;
|
|
|
- });
|
|
|
+ this.imageList = (res || []).map((item) => item.url);
|
|
|
},
|
|
|
},
|
|
|
};
|