Created
July 25, 2021 12:34
-
-
Save lukaszhanusik/a864c64294fdd7b4adc2df75d44215da to your computer and use it in GitHub Desktop.
LWC Slot handleSlotChange
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// _slotComboboxAddon; | |
// _slowComboboxContainer; | |
@track _slots = {}; | |
handleSlotChange(event) { | |
const slot = event.target; | |
this._slots[slot.name] = (slot.assignedElements().length !== 0); | |
// if (slot.name === 'combobox-addon') { | |
// this._slotComboboxAddon = (slot.assignedElements().length !== 0); | |
// this._slots[slot.name] = (slot.assignedElements().length !== 0); | |
// const slotHasElements = slot.assignedElements().length !== 0; | |
// this.items = slot.assignedElements().map(elem => elem.textContent); | |
// this._slotComboboxAddon = slotHasElements ? true : false; | |
// } | |
} | |
get isSlotsAssigned() { | |
let hasNulls; | |
Object.values(this._slots).forEach((value) => { | |
if (!value) { | |
hasNulls = true; | |
} | |
}); | |
return !hasNulls; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment