I have been trying to open a modal window onclick of a button menu. The modal will be child of the parent lwc and will be hidden. Its passed with some values
<lightning-button-menu class="slds-m-left_xx-small" variant="container" alternative-text="Show menu" icon-name="utility:settings" onselect={handleButtonselect}>
<lightning-menu-item value={topNewsItem.props.header} label="Email" prefix-icon-name="utility:email"></lightning-menu-item>
<lightning-menu-item value="Post" label="post" prefix-icon-name="utility:share_post"></lightning-menu-item>
<lightning-menu-item value="Task" label="task" prefix-icon-name="utility:task"></lightning-menu-item>
@track openEmail;
handleButtonselect(event) {
event.preventDefault();
event.stopPropagation();
console.log('here >>'+event.detail.value);
console.log('label >>'+event.detail);
var menuValue = 'Email';
switch(menuValue) {
case "Email": this.openEmail = true; break;
case "Post": this.post = true; break;
}
}
In handleButtonselect how can i know whether email event has been selected or post or anything else. I am trying to create a custom component to email or post, when clicked. Is there a better way ?
event.detail
only hasname
, interesting, I triedthis.template.querySelector
to get value, seems its more complex than it seems.