@aotearoan/neon
Version:
Neon is a lightweight design library of Vue 3 components with minimal dependencies.
49 lines (48 loc) • 1.17 kB
JavaScript
import { defineComponent as p, ref as s, watch as m } from "vue";
import i from "../link/NeonLink.vue.es.js";
import { useRoute as u } from "vue-router";
const y = p({
name: "NeonTreeMenu",
components: {
NeonLink: i
},
props: {
/**
* The tree model defining the menu.
*/
model: { type: Array, required: !0 },
/**
* Expand all nodes in the tree, this is useful for providing filtering (e.g. the Neon showcase side navigation menu).
*/
expandAll: { type: Boolean, default: !1 }
},
emits: [
/**
* Emitted when the user clicks on a menu item
* @type {string} the key of the clicked on menu item.
*/
"click"
],
setup(f, { emit: r }) {
const n = u(), t = s(null), a = (e) => {
const o = e.target;
o.parentElement && o.parentElement.click();
}, c = (e) => {
r("click", e);
}, l = (e) => e.toLowerCase().replace(/\s/g, "-");
return m(
() => n.path,
(e) => t.value = e,
{ immediate: !0 }
), {
url: t,
click: a,
onClick: c,
fragment: l
};
}
});
export {
y as default
};
//# sourceMappingURL=NeonTreeMenu.es.js.map