Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to close the menu after click on using body slot? #21

Open
jacdy opened this issue Jul 27, 2019 · 3 comments
Open

How to close the menu after click on using body slot? #21

jacdy opened this issue Jul 27, 2019 · 3 comments

Comments

@jacdy
Copy link

jacdy commented Jul 27, 2019

Hello:

The menu always showing after clicked each menu item.

<menu-item v-for="l in layout.language.list" :key="l.Id" @click.native="onChangeLanguage(l.AccessKey)" :sync="true">
<div slot="body">
<img :src="'/static/images/flags/' + layout.language.flags[l.AccessKey]" :class="'lng-image'" />{{l.Name}}
</div>
</menu-item>
@DAMisener
Copy link

I am experiencing a similar problem (details my issue report).

Did you ever resolve your problem? If so... any suggestions?

If not... did you use alternative component?.

@michitaro
Copy link
Owner

michitaro commented Sep 19, 2019

@jacdy

Sorry for the late response.
Bit tricky but to use the code below can close menu.

  <menu-bar-item Label="lang" ref="menuBarItem">
    <menu-item
      v-for="l in layout.language.list"
      :key="l.Id"
      @click.native="onChangeLanguage(l.AccessKey) ; $refs.menuBarItem.$refs.menu.close(true)"
    >
      <div slot="body">
        <img
          :src="'/static/images/flags/' + layout.language.flags[l.AccessKey]"
          :class="'lng-image'"
        />
      </div>
    </menu-item>
  </menu-bar-item>

or

  <menu-button-menu ref="buttonMenu">
    <button>Click Here</button>
    <template slot="contextmenu">
      <menu-item
        v-for="l in layout.language.list"
        :key="l.Id"
        @click.native="onChangeLanguage(l.AccessKey) ; $refs.menuBarItem.$refs.menu.close(true)"
      >
        <div slot="body">
          <img
            :src="'/static/images/flags/' + layout.language.flags[l.AccessKey]"
            :class="'lng-image'"
          />
        </div>
      </menu-item>
    </template>
  </menu-button-menu>

@jacdy
Copy link
Author

jacdy commented Sep 25, 2019

@michitaro Thanks a lot.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants