Vue UI Components Documentation
The Vue Menu enables you to add menus to your website or web application. This guide adds the Vue Menu (jqxMenu) to an app, then shows how to set its options, handle its events and call its methods.
jqwidgets-scriptsjqwidgets-scripts/jqwidgets-vue3/vue_jqxmenu.vue 
In a Vue 3 project (to start one, see Getting started with Vue), add the package:
npm install jqwidgets-scripts
import JqxMenu from 'jqwidgets-scripts/jqwidgets-vue3/vue_jqxmenu.vue';
import 'jqwidgets-scripts/jqwidgets/styles/jqx.base.css';
import 'jqwidgets-scripts/jqwidgets/styles/jqx.tailwind-blue-dark.css';
With <script setup>, an imported component is ready to use in the template. jqx.base.css is required; the second file is a theme, selected with the theme attribute.
The Default Functionality demo as a Single-File Component:
<template>
<div style="height: 300px">
<JqxMenu ref="myMenu" :width="670" :height="30" :autoSizeMainItems="false">
<ul>
<li><a href="#Home">Home</a></li>
<li>
Solutions
<ul style="width: 250px">
<li><a href="#Education">Education</a></li>
<li><a href="#Financial">Financial services</a></li>
<li><a href="#Government">Government</a></li>
<li><a href="#Manufacturing">Manufacturing</a></li>
<li type="separator"></li>
<li>
Software Solutions
<ul style="width: 220px">
<li><a href="#ConsumerPhoto">Consumer photo and video</a></li>
<li><a href="#Mobile">Mobile</a></li>
<li><a href="#RIA">Rich Internet applications</a></li>
<li>
<a href="#TechnicalCommunication">Technical communication</a>
</li>
<li><a href="#Training">Training and eLearning</a></li>
<li><a href="#WebConferencing">Web conferencing</a></li>
</ul>
</li>
<li><a href="#">All industries and solutions</a></li>
</ul>
</li>
<li>
Products
<ul>
<li><a href="#PCProducts">PC products</a></li>
<li><a href="#MobileProducts">Mobile products</a></li>
<li><a href="#AllProducts">All products</a></li>
</ul>
</li>
<li>
Support
<ul style="width: 200px">
<li><a href="#SupportHome">Support home</a></li>
<li><a href="#CustomerService">Customer Service</a></li>
<li><a href="#KB">Knowledge base</a></li>
<li><a href="#Books">Books</a></li>
<li><a href="#Training">Training and certification</a></li>
<li><a href="#SupportPrograms">Support programs</a></li>
<li><a href="#Forums">Forums</a></li>
<li><a href="#Documentation">Documentation</a></li>
<li><a href="#Updates">Updates</a></li>
</ul>
</li>
<li>
Communities
<ul style="width: 200px">
<li><a href="#Designers">Designers</a></li>
<li><a href="#Developers">Developers</a></li>
<li><a href="#Educators">Educators and students</a></li>
<li><a href="#Partners">Partners</a></li>
<li type="separator"></li>
<li>
By resource
<ul>
<li><a href="#Labs">Labs</a></li>
<li><a href="#TV">TV</a></li>
<li><a href="#Forums">Forums</a></li>
<li><a href="#Exchange">Exchange</a></li>
<li><a href="#Blogs">Blogs</a></li>
<li><a href="#Experience Design">Experience Design</a></li>
</ul>
</li>
</ul>
</li>
<li>
Company
<ul style="width: 180px">
<li><a href="#About">About Us</a></li>
<li><a href="#Press">Press</a></li>
<li><a href="#Investor">Investor Relations</a></li>
<li><a href="#CorporateAffairs">Corporate Affairs</a></li>
<li><a href="#Careers">Careers</a></li>
<li><a href="#Showcase">Showcase</a></li>
<li><a href="#Events">Events</a></li>
<li><a href="#ContactUs">Contact Us</a></li>
<li><a href="#Become an affiliate">Become an affiliate</a></li>
</ul>
</li>
</ul>
</JqxMenu>
<br />
<div style="margin-left: 60px; margin-top: 120px">
<div style="font-size: 16px; font-family: Verdana Arial">Settings</div>
<div style="margin-top: 20px; font-size: 14px; font-family: Verdana Arial; float: left">
<JqxCheckBox
@change="animationOnChange($event)"
:width="150"
:height="20"
:checked="true"
>
Enable Animation
</JqxCheckBox>
<div style="margin-top: 20px">
<JqxCheckBox
style="margin-top: 20px"
@change="disabledOnChange($event)"
:width="150"
:height="20"
:checked="false"
>
Disabled
</JqxCheckBox>
</div>
</div>
<div
style="
margin-top: 20px;
margin-left: 60px;
font-size: 14px;
font-family: Verdana Arial;
float: left;
"
>
<JqxCheckBox
@change="hoverOnChange($event)"
:width="150"
:height="20"
:checked="true"
>
Enable Hover
</JqxCheckBox>
<div style="margin-top: 20px">
<JqxCheckBox
@change="openOnChange($event)"
:width="150"
:height="20"
:checked="true"
>
Auto Open
</JqxCheckBox>
</div>
</div>
<div
style="
margin-top: 20px;
margin-left: 60px;
font-size: 14px;
font-family: Verdana Arial;
float: left;
"
>
<JqxCheckBox @change="topLevelArrowsOnChange($event)" :width="200" :height="20">
Show Top-Level Arrows
</JqxCheckBox>
</div>
</div>
</div>
</template>
<script setup>
import { ref } from 'vue';
import JqxMenu from 'jqwidgets-scripts/jqwidgets-vue3/vue_jqxmenu.vue';
import JqxCheckBox from 'jqwidgets-scripts/jqwidgets-vue3/vue_jqxcheckbox.vue';
const myMenu = ref(null);
function animationOnChange(event) {
let value = event.args.checked;
// enable or disable the menu's animation.
if (!value) {
myMenu.value.setOptions({
animationShowDuration: 0,
animationHideDuration: 0,
animationShowDelay: 0
});
} else {
myMenu.value.setOptions({
animationShowDuration: 300,
animationHideDuration: 200,
animationShowDelay: 200
});
}
}
function disabledOnChange(event) {
let value = event.args.checked;
// enable or disable the menu
if (!value) {
myMenu.value.disabled = false;
} else {
myMenu.value.disabled = true;
}
}
function hoverOnChange(event) {
let value = event.args.checked;
// enable or disable the menu's hover effect.
if (!value) {
myMenu.value.enableHover = false;
} else {
myMenu.value.enableHover = true;
}
}
function openOnChange(event) {
let value = event.args.checked;
// enable or disable the opening of the top level menu items when the user hovers them.
if (!value) {
myMenu.value.autoOpen = false;
} else {
myMenu.value.autoOpen = true;
}
}
function topLevelArrowsOnChange(event) {
let value = event.args.checked;
// enable or disable the top level arrows.
if (!value) {
myMenu.value.showTopLevelArrows = false;
} else {
myMenu.value.showTopLevelArrows = true;
}
}
</script>
<style></style>Options are attributes. Bind values from the script with :, for example :width="850".
Listen to an event with @ and its name. For example, itemclick: This event is triggered when a menu item is clicked.
<script setup>
function onItemclick(event) {
console.log(event.args);
}
</script>
<template>
<JqxMenu @itemclick="onItemclick" />
</template>
Call methods through a template ref. For example, open: Opens the menu(only in context menu mode).
<script setup>
import { ref, onMounted } from 'vue';
const myMenu = ref(null);
onMounted(() => {
myMenu.value.open(0, 0);
});
</script>
<template>
<JqxMenu ref="myMenu" />
</template>
Every component also has setOptions({ … }) and getOptions('name').