hookehuyr

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

......@@ -22,7 +22,7 @@
:multiple="item.component_props.multiple"
/>
</div>
<div class="type-text">上传格式:{{ type_text }}</div>
<div class="type-text">上传类型:&nbsp;{{ type_text }}</div>
<div
v-if="show_empty"
class="van-field__error-message"
......@@ -63,9 +63,13 @@ const props = defineProps({
const emit = defineEmits(["active"]);
const show_empty = ref(false);
// 固定类型限制
const imageTypes = "jpg/jpeg/png/gif/bmp/psd/tif";
// 文件类型中文页面显示
const type_text = computed(() => {
return props.item.component_props.image_type;
// return props.item.component_props.image_type;
return imageTypes;
});
// 上传图片集合
const fileList = ref([
......@@ -78,10 +82,11 @@ const fileList = ref([
// 上传前置处理
const beforeRead = (file) => {
// 类型限制
const image_types = _.map(
props.item.component_props.image_type.split("/"),
(item) => `image/${item}`
);
// const image_types = _.map(
// props.item.component_props.image_type.split("/"),
// (item) => `image/${item}`
// );
const image_types = _.map(imageTypes.split("/"), (item) => `image/${item}`);
let flag = true;
if (_.isArray(file)) {
......