Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

I want to be able to edit the image preview list by clicking on it. #264

Open
jungsikjeong opened this issue Jan 18, 2024 · 1 comment
Open

Comments

@jungsikjeong
Copy link

I am doing the following case:

  1. Upload multiple images.
    image

  2. Select the image you want to edit among them.

  3. When selected, the following code runs. (Load image with :src)

  <Cropper ref="cropper" class="cropper" @change="change" :src="image.src" />

But now the problem is
Cropper is not loading through :src.

The code for image is like this.

const image = reactive({
  src: '',
  type: 'image/jpg',
});

When you click an image on the screen, the following code runs.

const onImageChange = (e: any) => {
  const allImages = store.getters['imageStore/getImage']; // 변경
  const imageIndex = allImages.findIndex(
    (value: any) => value.toDataURL === e.target.src
  );

  testindex.value = 1;
  if (imageIndex !== -1) {
    image.src = allImages[imageIndex].src;
    isShowFile.value = true;
  }
};

As a result of taking console.log, image.src changed well, but

   <Cropper ref="cropper" class="cropper" @change="change" :src="image.src" />
Why is this :src not updated?
@Norserium
Copy link
Collaborator

@jungsikjeong, could you provide more code or reproduce this issue in the codesandbox?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants