1.0.0 • Published 1 year ago

vue-plugin-custom-event v1.0.0

Weekly downloads
-
License
MIT
Repository
github
Last release
1 year ago

vue-plugin-custom-event

add scope event support, registed events will be removed automaticly when unmounted

Usage

Install the plugin to vue app.

import { createApp } from 'vue'
import customEvent from 'vue-plugin-custom-event'
const app = createApp(xxxx);
app.use(customEvent);

Add events

mounted(){
	this.customEvent(window, 'keydown', ev => {
		//listen for keydown event on window
		console.log(ev);
	});
	//this event will be removed when this component is unmounted
}
1.0.0

1 year ago