# v-side-menu

> > An easy-to-use navigation component powered by Vue.js

Latest version **1.0.4-beta.6** (published 2023-01-30) · ISC license · 0 weekly downloads

## Install

```sh
npm install v-side-menu
pnpm add v-side-menu
yarn add v-side-menu
bun add v-side-menu
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.4-beta.6 |
| Published | 2023-01-30 |
| First published | 2022-10-24 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 196.2 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | karma |
| Maintainers | karnpm |

## Links

- npm: https://www.npmjs.com/package/v-side-menu
- npm.io page: https://npm.io/package/v-side-menu

## Recent versions

- 1.0.4-beta.6 (latest) — 2023-01-30
- 1.0.4-beta.5 — 2022-11-14
- 1.0.4-beta.4 — 2022-11-09
- 1.0.4-beta.3 — 2022-11-09
- 1.0.4-beta.2 — 2022-11-07
- 1.0.4-beta.1 — 2022-10-31
- 1.0.4-beta.0 — 2022-10-28
- 1.0.4 — 2022-10-26
- 1.0.3 — 2022-10-25
- 1.0.2 — 2022-10-25
- 1.0.1 — 2022-10-24
- 1.0.0 — 2022-10-24

## README

# v-side-menu

> An easy-to-use navigation component powered by Vue.js

## view Demo

![](https://pic1.imgdb.cn/item/63577a6916f2c2beb14f1e7c.png)

## Install

_You can use Yarn or NPM_

```bash
npm install v-side-menu
```

**OR**

```bash
yarn add v-side-menu
```

## Usage

```javascript
// Import the components where you need it
import SideMenu from "v-side-menu";
export default {
    components: [SideMenu]
}
```

## Props


| Name            | Type    | Default  | Description                                                                |
| ----------------- | --------- | ---------- | ---------------------------------------------------------------------------- |
| menuList        | Array   | []       | Menu List,A two-dimensional array, each array is listed from left to right |
| collectionList  | Array   | []       | Collection list                                                            |
| historyList     | Array   | []       | Recent Access List                                                         |
| collection      | Boolean | true     | Whether to display my collection                                           |
| history         | Boolean | true     | Whether to show recent visits                                              |
| search          | Boolean | true     | Whether to display search                                                  |
| showDrawer      | Boolean | false    | Drawer switch                                                              |
| drawerWidth     | String  | '1000px' | Drawer width                                                               |
| drawerPlacement | String  | 'left'   | Drawer pull out direction                                                  |
| drawerTop       | String  | '0px'    | Distance between drawer and top                                            |
| drawerTitle     | String  | ''       | Drawer title                                                               |
| closable        | Boolean | true     | Whether to display the close button                                        |
| mask            | Boolean | true     | Whether to display the mask                                                |
| maskClosable    | Boolean | true     | Click to close the mask                                                    |
| inner           | Boolean | false    | Whether to open in the parent element                                      |
| btnStyle        | Object  | {}       | Customize the default menu button style                                    |

## Events


| Name       | Parameters                    | Description                                         |
| ------------ | ------------------------------- | ----------------------------------------------------- |
| goLink     | arguments(item, historyData)                          | Return the currently clicked data & historyData                  |
| addStar    | arguments(item, collectionData)                       | Return the currently collected data & collectionData                  |
| removeStar | arguments(item, collectionData)                       | Return the currently removed data & collectionData                  |

## Examples

### Example - Basic Setup

```vue

<template>
  <div id="app">
    <side-menu drawer-width="1200px" drawer-top="57px"
               :menu-list="menuList"
               :collection-list="collectionList"
               :history-list="historyList"
               @addStar="changeCallback(arguments)"
               @removeStar="changeCallback(arguments)"
               @goLink="goLink(arguments)">
    </side-menu>
  </div>
</template>
<script>
import SideMenu from "v-side-menu"
export default {
  components: {
    SideMenu
  },
  data() {
    return {
      menuList: [],
      collectionList: [],
      historyList: []
    }
  },
  methods: {
    // Jump to url
    goLink: function (msg) {
      console.log(msg[0]) // item
      console.log(msg[1]) // historyData
    },
    // Processing history and collection data
    changeCallback: function (msg) {
      console.log(msg[0]) // item
      console.log(msg[1]) // collectionData
    }
  }
};
</script>
```

### Example - Customize menu buttons

```vue

<template>
  <div id="app">
    <side-menu drawer-width="1200px" drawer-top="57px"
               :drawer-show="open"
               :menu-list="menuList"
               :collection-list="collectionList"
               :history-list="historyList"
               @addStar="changeCallback(arguments)"
               @removeStar="changeCallback(arguments)"
               @goLink="goLink(arguments)">
      <button @click="open = !open">
        <span v-show="!open">点我展开</span>
        <span v-show="open">点我关闭</span>
      </button>
    </side-menu>
  </div>
</template>
<script>
import SideMenu from "v-side-menu"
export default {
  components: {
    SideMenu
  },
  data() {
    return {
      open: false,
      menuList: [],
      collectionList: [],
      historyList: []
    }
  },
  methods: {
    // Jump to url
    goLink: function (msg) {
      console.log(msg[0]) // item
      console.log(msg[1]) // historyData
    },
    // Processing history and collection data
    changeCallback: function (msg) {
      console.log(msg[0]) // item
      console.log(msg[1]) // collectionData
    }
  }
};
</script>
```

## API DATA

```javascript
// blank: Whether to open a new tab
// token: Whether the URL carries Token
// xxxxx: Define your own attributes
{
    menuList: [
        [
            {
                key: 'cloud_running',
                title: '云运营',
                id: 'cr',
                'sub': [
                    // 概览
                    { id: 'cr_1', key: 'cost_overview', title: '概览', link: '/cloud_overview' }
                ]
            }
        ],
        [
            {
                key: 'operation',
                title: '云运维',
                id: 'op',
                sub: [
                    // 概览
                    { id: 'op_1',  key: 'op_overview', title: '概览', link: '/op_overview', blank: true, token: true },
                    // 配置管理
                    { id: 'op_2',  key: 'op_config_manage', title: '配置管理', link: '/op_config_manage' }
                ]
            },
            {
                key: 'self_manage',
                title: '自服务',
                id: 'sm',
                'sub': [
                    // 概览
                    { id: 'sm_1', key: 'self_overview', title: '概览', link: '/cloud_overview' },
                    // 服务实例
                    { id: 'sm_2', key: 'service_instance', title: '服务实例', link: '/cloud_overview' }
                ]
            }
        ]
    ],
    historyList: [
        { id: 'op_1', key: 'op_overview', title: '概览', link: '/op_overview', blank: true, token: true }
    ],
    collectionList: [
        { id: 'sm_1', key: 'self_overview', title: '概览', link: '/cloud_overview' },
        { id: 'sm_2', key: 'service_instance', title: '服务实例', link: '/cloud_overview' }
    ]
}
```

---

## License

MIT

---
_Source: https://npm.io/package/v-side-menu · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
