Topic: how to use properties or variables in lazy load directives
bernspe priority asked 8 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 8 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
FREE CONSULTATION
Hire our experts to build a dedicated project. We'll analyze your business requirements, for free.
Answered
- 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