acdr-ui/dist/dev/mp-weixin/sheep/components/s-uploader/upload-image.js.map

1 line
11 KiB
Plaintext
Raw Normal View History

2024-09-19 07:20:14 +08:00
{"version":3,"file":"upload-image.js","sources":["../../../../../../src/sheep/components/s-uploader/upload-image.vue","../../../../../../uniComponent:/RDovQXBwL1dvcmsvYWRkci9hY2RyLXVpL3NyYy9zaGVlcC9jb21wb25lbnRzL3MtdXBsb2FkZXIvdXBsb2FkLWltYWdlLnZ1ZQ"],"sourcesContent":["<template>\r\n <view class=\"uni-file-picker__container\">\r\n <view class=\"file-picker__box\" v-for=\"(url, index) in list\" :key=\"index\" :style=\"boxStyle\">\r\n <view class=\"file-picker__box-content\" :style=\"borderStyle\">\r\n <image\r\n class=\"file-image\"\r\n :src=\"getImageUrl(url)\"\r\n mode=\"aspectFill\"\r\n @click.stop=\"previewImage(url, index)\"\r\n ></image>\r\n <view v-if=\"delIcon && !readonly\" class=\"icon-del-box\" @click.stop=\"delFile(index)\">\r\n <view class=\"icon-del\"></view>\r\n <view class=\"icon-del rotate\"></view>\r\n </view>\r\n <!-- <view v-if=\"item.errMsg\" class=\"file-picker__mask\" @click.stop=\"uploadFiles(item, index)\">\r\n 点击重试\r\n </view> -->\r\n </view>\r\n </view>\r\n <view v-if=\"list.length < limit && !readonly\" class=\"file-picker__box\" :style=\"boxStyle\">\r\n <view class=\"file-picker__box-content is-add\" :style=\"borderStyle\" @click=\"choose\">\r\n <slot>\r\n <view class=\"icon-add\"></view>\r\n <view class=\"icon-add rotate\"></view>\r\n </slot>\r\n </view>\r\n </view>\r\n </view>\r\n</template>\r\n\r\n<script>\r\nimport sheep from '@/sheep'\r\nexport default {\r\n name: 'uploadImage',\r\n emits: ['uploadFiles', 'choose', 'delFile'],\r\n props: {\r\n filesList: {\r\n type: [Array, String],\r\n default() {\r\n return []\r\n },\r\n },\r\n disabled: {\r\n type: Boolean,\r\n default: false,\r\n },\r\n disablePreview: {\r\n type: Boolean,\r\n default: false,\r\n },\r\n limit: {\r\n type: [Number, String],\r\n default: 9,\r\n },\r\n imageStyles: {\r\n type: Object,\r\n default() {\r\n return {\r\n width: 'auto',\r\n height: 'auto',\r\n border: {},\r\n }\r\n },\r\n },\r\n delIcon: {\r\n type: Boolean,\r\n default: true,\r\n },\r\n readonly: {\r\n type: Boolean,\r\n default: false,\r\n },\r\n },\r\n computed: {\r\n list() {\r\n if (typeof this.filesList === 'string') {\r\n if (this.filesList) {\r\n return [this.filesList]\r\n } else {\r\n return []\r\n }\r\n }\r\n return this.filesList\r\n },\r\n styles() {\r\n const styles = {\r\n width: 'auto',\r\n height: 'auto',\r\n border: {},\r\n }\r\n return Object.assign(styles, this.imageStyles)\r\n },\r\n boxStyle() {\r\n const { width = 'auto', height = 'auto' } = this.styles\r\n const obj = {}\r\n if (height === 'auto') {\r\n if (width !== 'auto') {\r\n obj.height = this.value2px(width)\r\n obj['padding-top'] = 0\r\n } else {\r\n obj.height = 0\r\n }\r\n } else {\r\n obj.height = this.value2px(height)\r\n obj['padding-top'] = 0\r\n }\r\n\r\n if (width === 'auto') {\r\n if (height !== 'auto') {\r\n obj.width = this.value2px(height)\r\n } else {\r\n obj.width = '33.3%'\r\n }\r\n } else {\r\n obj.width = this.value2px(width)\r\n }\r\n\r\n let classles = ''\r\n for (const i in obj) {\r\n classles += `${i}:${obj[i]};`\r\n }\r\n return classles\r\n },\r\n borderStyle() {\r\n const { border } = this.styles\r\n let obj = {}\r\n const widthDefaultValue = 1\r\n const radiusDefaultValue = 3\r\n if (typeof border === 'boolean') {\r\n obj.border = border ? '1px #eee solid' : 'none'\r\n } else {\r\n let width = (border && border.width) || widthDefaultValue\r\n width = this.value2px(width)\r\n