兰宝车间质量管理系统-前端
ahao
2024-01-06 31da01bdd1e4fe8fb8eec41f401d73bcf6cc18b7
src/components/ImageUpload/index.vue
@@ -46,7 +46,10 @@
import { globalHeaders } from '@/utils/request';
const props = defineProps({
  modelValue: [String, Object, Array],
  modelValue: {
    type: [String, Object, Array],
    default: () => []
  },
  // 图片数量限制
  limit: propTypes.number.def(5),
  // 大小限制(MB)
@@ -78,14 +81,14 @@
watch(
  () => props.modelValue,
  async (val) => {
  async (val: string) => {
    if (val) {
      // 首先将值转为数组
      let list: OssVO[] = [];
      if (Array.isArray(val)) {
        list = val as OssVO[];
      } else {
        const res = await listByIds(val as string);
        const res = await listByIds(val);
        list = res.data;
      }
      // 然后将数组转为对象数组