mirror of
https://gitee.com/vant-contrib/vant.git
synced 2025-04-25 02:41:46 +08:00
chore: remove click outside mixin
This commit is contained in:
parent
cd5f5bb655
commit
b78b1e8c9e
@ -1,31 +0,0 @@
|
|||||||
/**
|
|
||||||
* Listen to click outside event
|
|
||||||
*/
|
|
||||||
import { on, off } from '../utils/dom/event';
|
|
||||||
|
|
||||||
export const ClickOutsideMixin = (config) => ({
|
|
||||||
props: {
|
|
||||||
closeOnClickOutside: {
|
|
||||||
type: Boolean,
|
|
||||||
default: true,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
|
|
||||||
data() {
|
|
||||||
const clickOutsideHandler = (event) => {
|
|
||||||
if (this.closeOnClickOutside && !this.$el.contains(event.target)) {
|
|
||||||
this[config.method]();
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
return { clickOutsideHandler };
|
|
||||||
},
|
|
||||||
|
|
||||||
mounted() {
|
|
||||||
on(document, config.event, this.clickOutsideHandler);
|
|
||||||
},
|
|
||||||
|
|
||||||
beforeUnmount() {
|
|
||||||
off(document, config.event, this.clickOutsideHandler);
|
|
||||||
},
|
|
||||||
});
|
|
Loading…
x
Reference in New Issue
Block a user