npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

zeus-sidebar-menu

v1.1.3

Published

菜单树

Downloads

2

Readme

社区3.0-基于react版本的左侧菜单组件

效果

alt

安装

npm install zeus-sidebar-menu

使用

ES6写法

import React from "react";
import { render } from "react-dom";
import Menu from "zeus-sidbar-menu";

//要渲染的数据,请确保有为一个key值吧
let data = [
    {
            label: "计生业务",
            key: "jsyw",
            children: [
                {
                    label: "事件管理",
                    key: "sjgl"
                },
                {
                    label: "综治业务",
                    key: "zzyw"
                },
                {
                    label: "教育积分",
                    key: "jyjf"
                }
            ]
        },
        {
            label: "决策分析",
            key: "jcfx"
        }
];
//配置字段名称
let fieldName = {
    labelField: "label",
    childrenField: "children",
    idField: "key",
    openTypeField: "openType"
};
//监听菜单点击事件,node代表当前点击的数据对象,target则是代表当前点击的dom节点
var handleClick = function (node, target) {
    console.info(node, target);
};
//菜单初始化时所选中的菜单名称
let defaultExpandName = "考核评估";
render(
    <Menu data={data} handleClick={handleClick} defaultExpandName={defaultExpandName} fieldName={fieldName}/>,
    document.getElementById("demo")
);

ES5写法

var $ = require("jquery");
var React = require("react");
var render = require("react-dom").render;
var Menu = require("../dist/components").default;
var data = [
    {
        label: "计生业务",
        key: "jsyw",
        children: [
            {
                label: "事件管理",
                key: "sjgl",
                children: [
                    {
                        label: "事件管理1",
                        key: "sjgl1"
                    },
                    {
                        label: "事件管理2",
                        key: "sjgl2"
                    }
                ]
            },
            {
                label: "综治业务",
                key: "zzyw"
            },
            {
                label: "教育积分",
                key: "jyjf"
            }
        ]
    },
    {
        label: "决策分析",
        key: "jcfx"
    },
    {
        label: "视频监控",
        key: "spjk",
        children: [
            {
                label: "考核评估",
                key: "khpg"
            },
            {
                label: "党建台账",
                key: "djtz"
            }
        ]
    }
];

var handleClick = function (node, target) {
    console.info(node, target);
};

var fieldName = {
    labelField: "label",
    childrenField: "children",
    idField: "key",
    openTypeField: "openType"
};

//菜单初始化时所选中的菜单名称
var defaultExpandName = "综治业务";

render(
    <Menu data={data} handleClick={handleClick} defaultExpandName={defaultExpandName} fieldName={fieldName}/>,
    document.getElementById("demo")
);

更新日志

  • v1.1.1:修改样式;添加链接类型(window,ie,defaultBrowser,cs)图标且不能选中;增加菜单title
  • v1.1.0:改善菜单收起展开效果;
  • v1.0.9:增加初始化时默认选中指定菜单功能;增加说明文档;
  • v1.0.8:修改菜单收起和展开为jquery的slide效果;
  • v1.0.7:修改样式;只保留第一层菜单outlook风格;
  • v1.0.6:基本功能展现;数据字段可配;