项目作者: Armaldio

项目描述 :
Control the browsers window the Vue way!
高级语言: Vue
项目地址: git://github.com/Armaldio/vue-browser-window.git
创建时间: 2018-08-31T01:49:28Z
项目社区:https://github.com/Armaldio/vue-browser-window

开源协议:MIT License

下载


vue-browser-window

Control your window the Vue way!

Usage

Installation

Using yarn

yarn add vue-browser-window

Using npm

npm i --save vue-browser-window

Usage

First import the component:

  1. import VueBrowserWindow from 'vue-browser-window';

Add it to you vue model

  1. export default {
  2. components: {
  3. BrowserWindow: VueBrowserWindow
  4. }
  5. }

Finally, wrap you app with the component

  1. <template>
  2. <browser-window @wheel="event = 'wheel'" @resize="event = 'resize'">
  3. <div id="app"></div>
  4. </browser-window>
  5. </template>

Summary:

  1. <template>
  2. <browser-window @wheel="event = 'wheel'" @resize="event = 'resize'">
  3. <div id="app">
  4. Last event: {{ event }}
  5. </div>
  6. </browser-window>
  7. </template>
  8. <script>
  9. import VueBrowserWindow from '../../';
  10. export default {
  11. name : 'app',
  12. components: {
  13. BrowserWindow: VueBrowserWindow
  14. },
  15. data () {
  16. return {
  17. event: ''
  18. };
  19. },
  20. };
  21. </script>

From: demo/src/App.vue

Todo

  • Support all window events

Do not hesitate to submit your request for a new feature or a change, or directly a PR! Help is greatly appreciated!

License

This project is licensed under MIT License