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

Re-render after changing imagePath #34

Open
alexsoin opened this issue Dec 29, 2021 · 1 comment
Open

Re-render after changing imagePath #34

alexsoin opened this issue Dec 29, 2021 · 1 comment

Comments

@alexsoin
Copy link

alexsoin commented Dec 29, 2021

How do I force the component to redraw after changing the link in the imagePath attribute?

@alexsoin
Copy link
Author

While I implemented it in the following way, I added a ref when calling the component:

<vue-three-sixty
  :amount="47"
  :imagePath="teplica360"
  :disableZoom="true"
  :fileName="fileName360"
  ref="comp360"
/>

and subscribed to the imagePath value change event:

this.$refs.comp360.$watch('imagePath', function(newValue, oldValue) {
  console.log('imagePath changed from ' + oldValue + ' to ' + newValue);
  
  this.imagesLoaded = false;
  this.imageData = [];
  this.images = [];
  this.loadedImages = 0;
  
  this.fetchData();
});

Perhaps this functionality would be better added to the component itself?

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

1 participant