
Security News
libxml2 Maintainer Ends Embargoed Vulnerability Reports, Citing Unsustainable Burden
Libxml2’s solo maintainer drops embargoed security fixes, highlighting the burden on unpaid volunteers who keep critical open source software secure.
npm install mj-menu --save
参数 描述 是否必须 mjMenuTree
数据源 true
selectCallback
菜单激活的回调 false
openCallback
sub-menu展开的回调 false
closeCallback
sub-menu收起的回调 false
html
<template>
<div>
<mj-menu
:mjMenuTree="menuTree"
@selectCallback="selectCallback"
@openCallback="openCallback"
@closeCallback="closeCallback"
></mj-menu>
</div>
</template>
javaScript
import mjMenu from "mj-menu";
export default {
components: { mjMenu },
data() {
return {
menuTree: [],
menuTrees: [
{
id: "1",
label: "一级 1",
children: [
{
id: "2",
label: "二级 1-1",
children: [
{
id: "3",
label: "三级 1-1-1",
},
],
},
],
},
{
id: "4",
label: "一级 2",
children: [
{
id: "5",
label: "二级 2-1",
children: [
{
id: "6",
label: "三级 2-1-1",
},
],
},
{
id: "7",
label: "二级 2-2",
children: [
{
id: "8",
label: "三级 2-2-1",
},
],
},
],
},
{
id: "9",
label: "一级 3",
children: [
{
id: "10",
label: "二级 3-1",
children: [
{
id: "11",
label: "三级 3-1-1",
},
],
},
{
id: "12",
label: "二级 3-2",
children: [
{
id: "13",
label: "三级 3-2-1",
},
],
},
],
},
],
};
},
created() {
this.menuTree = this.handleMenuTree(this.menuTrees);
},
methods: {
// sub-menu收起的回调
closeCallback(val) {
console.log("sub-menu收起的回调:", val);
},
// sub-menu展开的回调
openCallback(val) {
console.log("sub-menu展开的回调:", val);
},
// 菜单激活的回调
selectCallback(val) {
console.log("菜单激活的回调:", val);
},
// 随机生成菜单图标
handleMenuTree(menuTrees) {
let icon = [
"el-icon-setting",
"el-icon-user",
"el-icon-star-off",
"el-icon-warning-outline",
"el-icon-upload",
"el-icon-s-order",
"el-icon-c-scale-to-original",
"el-icon-coin",
"el-icon-receiving",
"el-icon-cpu",
"el-icon-sugar",
"el-icon-ice-cream-square",
"el-icon-milk-tea",
"el-icon-watch",
"el-icon-mobile",
"el-icon-tickets",
];
menuTrees.forEach((item) => {
let indexRandom = Math.floor(Math.random() * (15 - 0 + 1)) + 0;
item.icon = icon[indexRandom];
if (item.children) this.handleMenuTree(item.children);
});
return menuTrees;
},
},
};
FAQs
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Libxml2’s solo maintainer drops embargoed security fixes, highlighting the burden on unpaid volunteers who keep critical open source software secure.
Research
Security News
Socket investigates hidden protestware in npm packages that blocks user interaction and plays the Ukrainian anthem for Russian-language visitors.
Research
Security News
Socket researchers uncover how browser extensions in trusted stores are used to hijack sessions, redirect traffic, and manipulate user behavior.