zhangxiao
2024-08-06 6860f30ff7ab6cb5097e63b37411364827e08bfa
src/components/upload/index.vue
@@ -23,37 +23,18 @@
  const emit = defineEmits(['update:fileList', 'success']);
  const fileList = ref([]);
  // const urls = computed(() => {
  //   debugger;
  //   console.log(props.url, 999999);
  //   // if (props.urlS) {
  //   //   console.log(props.urlS, 999999);
  //   //   return props.urlS.split(',');
  //   // }
  //   // return props.urlS ? [props.urlS] : [];
  // });
  // watchEffect(() => {
  //   fileList.value = urls.value.map((item) => ({
  //     uid: item,
  //     name: item,
  //     status: 'done',
  //     url: item,
  //   }));
  // });
  watch(
    () => props.url,
    (newVal) => {
      debugger;
      console.log(newVal, 8888);
      // if (newVal) {
      //   fileList.value = newVal.split(',').map((item) => ({
      //     uid: item,
      //     name: item,
      //     status: 'done',
      //     url: item,
      //   }));
      // }
      if (newVal) {
        fileList.value = newVal.split(',').map((item) => ({
          uid: item,
          name: item,
          status: 'done',
          url: item,
        }));
      }
    },
    {
      deep: true, // 开启深度监听