window-plugin

1.0.4 • Public • Published

The Vue WindowPlugin adds $window and $document DOM objects to each Vue component. This is helpful when accessing DOM from attribute templates. allowing you to call DOM methods without declaring a method.

For example, you can open alerts, log events, or open URLs in new tabs.

Usage

<button @click='$window.alert("You clicked a button.")'>Click Me</button>
<button @click='$window.console.log("A button was clicked.")'>Click Me</button>
<button @click='$window.open("https://www.quickchords.org/", "_blank"))'>Click Me</button>
<h1 :v-text='$document.title' />

Installation

Install the package via NPM

npm install --save window-plugin

Install the plugin before creating your Vue

import Vue from 'vue'
 
import WindowPlugin from 'window-plugin'
Vue.use(WindowPlugin)
 
new Vue({
    // your code here
})

Dependencies

None

Package Sidebar

Install

npm i window-plugin

Weekly Downloads

11

Version

1.0.4

License

ISC

Unpacked Size

5.02 kB

Total Files

4

Last publish

Collaborators

  • steven.spungin