# vue-action-pannel

> vue, action-sheet, pannel

Latest version **0.1.1** (published 2019-05-09) · 0 weekly downloads

## Install

```sh
npm install vue-action-pannel
pnpm add vue-action-pannel
yarn add vue-action-pannel
bun add vue-action-pannel
```

## Health

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

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; low quality score; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.1.1 |
| Published | 2019-05-09 |
| First published | 2019-04-15 |
| Weekly downloads | 0 |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 368.4 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Maintainers | a62527776a |

## Links

- npm: https://www.npmjs.com/package/vue-action-pannel
- npm.io page: https://npm.io/package/vue-action-pannel

## Recent versions

- 0.1.1 (latest) — 2019-05-09
- 0.1.0 — 2019-04-24
- 0.0.9 — 2019-04-23
- 0.0.8 — 2019-04-23
- 0.0.7 — 2019-04-23
- 0.0.6 — 2019-04-23
- 0.0.5 — 2019-04-23
- 0.0.4 — 2019-04-17
- 0.0.3 — 2019-04-16
- 0.0.2 — 2019-04-15
- 0.0.1 — 2019-04-15

## README

# Vue ActionPannel

##### ❤❤❤❤ a beautiful Action Pannel ❤❤❤❤

<p align="center">
  <a href="https://www.npmjs.com/package/vue-action-pannel">
		<img src="https://img.shields.io/npm/v/vue-action-pannel.svg" alt="Version">
	</a>
	<!-- <img src="https://img.shields.io/badge/min+gzip-5.8_kB-blue.svg" alt="5.8 kB min+gzip"> -->
  <a href="https://github.com/a62527776a/vue-action-pannel/blob/master/LICENSE"><img
            src="https://img.shields.io/badge/license-MIT-brightgreen.svg" alt="License"></a>
  <br>
</p>



![demo1.gif](https://upload-images.jianshu.io/upload_images/5738345-8c7f1d5d20c1e2c7.gif?imageMogr2/auto-orient/strip)

**[live demo](https://dscsdoj.top/public/vue-action-pannel/index.html)**

#### What's this
###### 基于 vue-create-api 的活动面板 用于展示不同的操作接口

## Installation and use

```
$ yarn add vue-action-pannel
or
$ npm install vue-action-pannel --save
```

```
import App from './App.vue'
import ActionPannel from 'vue-action-pannel'
import Vue from 'vue'

Vue.use(ActionPannel)

new Vue({
  render: h => h(App)
}).$mount('#app')

```

```
data () {
  return {
    // 初始化以下格式的list
    actions: [{
      icon: 'icon-article', // 引入iconfont的类名作为展示的icon
      text: '分享' // 引入文字作为标题
    }, {
      icon: 'icon-xiazai46',
      text: '客服'
    }, {
      icon: 'icon-yidong',
      text: '移动'
    }]
  }
}

methods: {
  // 得益于vue-create-api
  // 我们可以以函数的形式创建一个action-pannel
  openPannel: function () {
    let actionPannel = this.$createActionPannel({ // 函数式调用 将返回一个Vue实例
      $props: {
        actions: this.actions // 传入列表项
      }
    }).$on('select', (e) => { // 暴露select事件
      window.alert(`click: ${e.idx}, params: ${JSON.stringify(e.item)}`) // 参数包含下标以及传入的菜单项
      actionPannel.closePannel() // 完成操作后一定要使用closePannel函数来关闭这个面板哦
    })
  },
}
```

# props

| name    | type  | desc    |  
| --------| ----- |------   |
| actions | action | 活动列表 由一个个活动项数组组成 即[action, action, action] action对象结构为{icon: 'xxx', text: 'xxx'} |

# methods
| name | desc |
| ---- | ---- |
|closePannel | 关闭该pannel 必须在select事件后执行 将会关闭pannel以及展示相应的效果 |

# event
| name | params | desc |
| ------ | ------ | ------ |
|  select| Object | 点击每个活动项后会触发一个select事件 select事件将会回调一个包含下标和选中的活动项对象(包含该活动项的icon以及标题)  |

```
let actionPannel = this.$createActionPannel({ // 函数式调用 将返回一个Vue实例
  $props: {
    actions: this.actions // 传入列表项
  }
})
actionPannel.$on('select', (e) => { // 暴露select事件
  console.log(e) // { idx: 0, item: { icon: 'icon-xiazai46', text: '客服' } }
  actionPannel.closePannel() // 完成操作后一定要使用closePannel函数来关闭这个面板哦
})
```

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