Topic: how to use properties or variables in lazy load directives

bernspe priority asked 3 months ago

Expected behavior How would one write the directive to use a dynamic ressource as src property for image ? e.g. v-mdb-lazy="{ src: picsdir+get_random(whodas[props.itemkey].p), placeholder: '', parent: '#lazy-container-1' }"

where picsdir and get_random... are javascript variables, terms.. Actual behavior

Resources (screenshots, code snippets etc.)

Bartosz Cylwik staff answered 3 months ago

Hi, I think the easiest way would be to unmount the lazy element and mount it again after the image changes. Checkout this snippet:

Please insert min. 20 characters.


Hire our experts to build a dedicated project. We'll analyze your business requirements, for free.



Specification of the issue

  • ForumUser: Priority
  • Premium support: Yes
  • Technology: MDB Vue
  • MDB Version: MDB5 4.1.1
  • Device: Desktop
  • Browser: Chrome
  • OS: MacOSX
  • Provided sample code: No
  • Provided link: Yes