hookehuyr

图片上传控件固定上传类型

...@@ -22,7 +22,7 @@ ...@@ -22,7 +22,7 @@
22 :multiple="item.component_props.multiple" 22 :multiple="item.component_props.multiple"
23 /> 23 />
24 </div> 24 </div>
25 - <div class="type-text">上传格式:{{ type_text }}</div> 25 + <div class="type-text">上传类型:&nbsp;{{ type_text }}</div>
26 <div 26 <div
27 v-if="show_empty" 27 v-if="show_empty"
28 class="van-field__error-message" 28 class="van-field__error-message"
...@@ -63,9 +63,13 @@ const props = defineProps({ ...@@ -63,9 +63,13 @@ const props = defineProps({
63 const emit = defineEmits(["active"]); 63 const emit = defineEmits(["active"]);
64 const show_empty = ref(false); 64 const show_empty = ref(false);
65 65
66 +// 固定类型限制
67 +const imageTypes = "jpg/jpeg/png/gif/bmp/psd/tif";
68 +
66 // 文件类型中文页面显示 69 // 文件类型中文页面显示
67 const type_text = computed(() => { 70 const type_text = computed(() => {
68 - return props.item.component_props.image_type; 71 + // return props.item.component_props.image_type;
72 + return imageTypes;
69 }); 73 });
70 // 上传图片集合 74 // 上传图片集合
71 const fileList = ref([ 75 const fileList = ref([
...@@ -78,10 +82,11 @@ const fileList = ref([ ...@@ -78,10 +82,11 @@ const fileList = ref([
78 // 上传前置处理 82 // 上传前置处理
79 const beforeRead = (file) => { 83 const beforeRead = (file) => {
80 // 类型限制 84 // 类型限制
81 - const image_types = _.map( 85 + // const image_types = _.map(
82 - props.item.component_props.image_type.split("/"), 86 + // props.item.component_props.image_type.split("/"),
83 - (item) => `image/${item}` 87 + // (item) => `image/${item}`
84 - ); 88 + // );
89 + const image_types = _.map(imageTypes.split("/"), (item) => `image/${item}`);
85 90
86 let flag = true; 91 let flag = true;
87 if (_.isArray(file)) { 92 if (_.isArray(file)) {
......