# @jizhongce/vue-click-outside

> Customized directives which can be used in vue to trigger some handler or function when click outside the element.

Latest version **1.1.2** (published 2019-07-15) · MIT license · 0 weekly downloads

## Install

```sh
npm install @jizhongce/vue-click-outside
pnpm add @jizhongce/vue-click-outside
yarn add @jizhongce/vue-click-outside
bun add @jizhongce/vue-click-outside
```

## 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.1.2 |
| Published | 2019-07-15 |
| First published | 2019-07-12 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 1 |
| Unpacked size | 2.8 KB |
| Known vulnerabilities | 0 (+1 in 1 direct dependencies) |
| Install scripts | no |
| GitHub stars | 0 |
| Author | jizhongce |
| Maintainers | jizhongce |
| Keywords | ClickOutside |

## Links

- npm: https://www.npmjs.com/package/@jizhongce/vue-click-outside
- Repository: https://github.com/jizhongce/vue-click-outside
- Homepage: https://github.com/jizhongce/vue-click-outside#readme
- Issues: https://github.com/jizhongce/vue-click-outside/issues
- npm.io page: https://npm.io/package/@jizhongce/vue-click-outside

## Dependencies (1)

- [vue](https://npm.io/package/vue.md) ^2.6.10

## Alternatives

- [@sindresorhus/slugify](https://npm.io/package/@sindresorhus/slugify.md) — 3.7M weekly downloads
- [solid-js](https://npm.io/package/solid-js.md) — 2.7M weekly downloads
- [expo-glass-effect](https://npm.io/package/expo-glass-effect.md) — 2.5M weekly downloads
- [nanoassert](https://npm.io/package/nanoassert.md) — 780.8K weekly downloads
- [@ffmpeg/ffmpeg](https://npm.io/package/@ffmpeg/ffmpeg.md) — 529.5K weekly downloads

## Recent versions

- 1.1.2 (latest) — 2019-07-15
- 1.1.1 — 2019-07-15
- 1.1.0 — 2019-07-12

## README

vue-click-outside
========================

1. 点击视图外关闭视图
2. 这是一个vue自定义指令，可适用于全局和局部


Installation
========================

```
npm install @jizhongce/vue-click-outside
```

使用 & 参数
========================

#### 全局引用

```
import ClickOutside from '@jizhongce/vue-click-outside'


vue.use(ClickOutside)
```


#### 局部引用

在想要使用的组件内加入

```
import { ClickOutside } from @jizhongce/vue-click-outside'

export default {
  directives: {
    ClickOutside
  }
}

```

#### 用法

```
v-click-outside="{closehandler: 'handlerfunction', excluderef: ['some-class-you-want-exclude']}"
```

*closehandler* 传入用于关闭视图的函数，*excluderef* 传入想要排除的元素的class，比如当点击一些button后不想关闭视图，那就把这些button的class带入


#### 例子

```
<el-card v-show="show" v-click-outside="{closehandler: 'closeCard', excluderef: ['DetailedPkgButton']}">
.......
</el-card>

export default {
    data() {
        show: true
    },
    methods:{
		test(val){
			console.log(val)
		},

		closeCard(){
			this.show = false
		},
    },
    directives: {
        ClickOutside
 	}

}
```

例子中当点击元素class中带有DetailedPkgButton的标识时将不会关闭对话框

License
========================

MIT
Copyright (c) 2019 Zhongce Ji

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