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

bernspe priority asked 7 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: 'https://place-hold.it/1321x583?text=Loading', parent: '#lazy-container-1' }"

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

Resources (screenshots, code snippets etc.)


Bartosz Cylwik staff answered 7 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:

https://mdbootstrap.com/snippets/vue/b-cylwik/6054338#js-tab-view



Please insert min. 20 characters.

FREE CONSULTATION

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

Status

Answered

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