#se-menu menu item add img changes

This commit is contained in:
Agriya Dev5
2020-12-04 18:37:18 +05:30
parent f6d628a7bf
commit d118bc6884
10 changed files with 123 additions and 11 deletions

View File

@@ -44,16 +44,16 @@ export class SeMenuItem extends HTMLElement {
* @returns {void}
*/
attributeChangedCallback (name, oldValue, newValue) {
let shortcut = '';
if (oldValue === newValue) return;
switch (name) {
case 'src':
this.$img.setAttribute('src', newValue);
this.$img.style.display = 'block';
this.$img.style.display = 'inline-block';
break;
case 'label':
const shortcut = this.getAttribute('shortcut');
shortcut = this.getAttribute('shortcut');
this.$label.textContent = `${newValue} ${shortcut ? `(${shortcut})` : ''}`;
this.$img.remove();
break;
default:
// eslint-disable-next-line no-console