Skip to content

Commit

Permalink
update: #903 template-selectedIndex
Browse files Browse the repository at this point in the history
  • Loading branch information
JiHong88 committed Feb 5, 2022
1 parent 64688fc commit a74aa92
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/plugins/submenu/template.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,9 @@ export default {
display: 'submenu',
add: function (core, targetElement) {
const context = core.context;
context.template = {};
context.template = {
selectedIndex: -1
};

/** set submenu */
let templateDiv = this.setSubmenu(core);
Expand Down Expand Up @@ -55,7 +57,8 @@ export default {
e.preventDefault();
e.stopPropagation();

const temp = this.options.templates[e.target.getAttribute('data-value')];
this.context.template.selectedIndex = e.target.getAttribute('data-value') * 1;
const temp = this.options.templates[this.context.template.selectedIndex];

if (temp.html) {
this.setContents(temp.html);
Expand Down

0 comments on commit a74aa92

Please sign in to comment.