vue-visibility
v0.0.2
Published
A simple Vue.js component for visibility
Downloads
5
Readme
vue-visibility
一个用于监听页面可见性(显示/隐藏)的vue组件
安装
使用npm命令安装
npm install vue-visibility
使用
引入vue-visibility,并使用Vue.use()注册插件,之后即可使用
<template>
<div id="app">
<vue-visibility @change="handleVisibilityChange">
Content
</vue-visibility>
</div>
</template>
<script>
import VueVisibility from 'vue-visibility'
import Vue from 'vue'
Vue.use(VueVisibility)
export default {
methods: {
handleVisibilityChange (hidden) {
const result = hidden ? '页面隐藏' : '页面显示';
console.log(result);
},
},
}
</script>