sh-view 1.7.3 → 1.7.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,100 +0,0 @@
1
- <template>
2
- <template v-if="uploadList.length > 0">
3
- <div v-for="(item, index) in uploadList" :key="index" class="sh-upload-list" :style="upStyles" :class="upClass">
4
- <div v-if="listType === 'card'" class="list-file-card">
5
- <u-img v-if="type === 'img'" :src="item.url" :file="item"></u-img>
6
- <div v-else class="file-title">{{ item.name }}</div>
7
- <div class="list-file-cover">
8
- <sh-icon v-if="preview" type="ios-eye-outline" title="查看文件" size="18" @click="handleFilePreviewView(item)" />
9
- <sh-icon v-if="!disabled" type="ios-trash-outline" title="删除文件" size="18" @click="handleFileRemove(item)" />
10
- </div>
11
- </div>
12
- <div v-else class="list-file-item">
13
- <div class="file-title">{{ item.name }}</div>
14
- <div class="file-action">
15
- <span v-if="preview" class="file-action-item"><sh-icon type="ios-eye-outline" title="查看文件" size="18" @click="handleFilePreviewView(item)" /></span>
16
- <span v-if="!disabled" class="file-action-item"><sh-icon type="ios-trash-outline" title="删除文件" size="18" @click="handleFileRemove(item)" /></span>
17
- </div>
18
- </div>
19
- </div>
20
- </template>
21
- <sh-modal v-if="previewModal" v-model="previewModal" title="预览查看" height="100%" readonly @close="handleFilePreviewCancel">
22
- <template v-if="type === 'file'">
23
- <sh-preview :url="previewFile.url"></sh-preview>
24
- </template>
25
- <template v-else-if="isFormData && type === 'img'">
26
- <u-img :src="previewFile && previewFile.url" :file="previewFile" style="max-width: 100%; margin: auto; display: block"></u-img>
27
- </template>
28
- </sh-modal>
29
- </template>
30
-
31
- <script>
32
- import UImg from './u-img.vue'
33
- export default {
34
- name: 'UList',
35
- components: {
36
- UImg
37
- },
38
- props: {
39
- uploadList: {
40
- type: Array,
41
- default() {
42
- return []
43
- }
44
- },
45
- type: {
46
- type: String,
47
- default: 'img' // file 上传图片还是文件
48
- },
49
- listType: {
50
- type: String,
51
- default: 'list' // list 附件列表展示类型
52
- },
53
- isFormData: Boolean,
54
- disabled: Boolean,
55
- preview: Boolean,
56
- upStyles: {
57
- type: Object,
58
- default() {
59
- return {}
60
- }
61
- },
62
- upClass: {
63
- type: [Array, Object],
64
- default() {
65
- return {}
66
- }
67
- }
68
- },
69
- emits: ['delete'],
70
- data() {
71
- return {
72
- previewFile: null,
73
- previewModal: false
74
- }
75
- },
76
- methods: {
77
- // 文件预览
78
- handleFilePreviewView(obj) {
79
- if (this.isFormData || this.type === 'file') {
80
- this.previewFile = obj
81
- this.previewModal = true
82
- } else {
83
- this.$ImagePreview.show({
84
- previewList: [obj.url]
85
- })
86
- }
87
- },
88
- // 文件预览取消
89
- handleFilePreviewCancel() {
90
- this.previewModal = false
91
- },
92
- // 文件删除
93
- handleFileRemove(data) {
94
- this.$emit('delete', data)
95
- }
96
- }
97
- }
98
- </script>
99
-
100
- <style scoped lang="scss"></style>