1.0.0 • Published 6 years ago
@zxy-cn/i-am-here v1.0.0
i-am-here
i-am-here一个vue指令,当绑定元素出现在视图中时,触发回调函数
使用
npm i i-am-here --s
局部指令
<script>
import hi from "i-am-here";
export default {
name: 'app',
directives:{
hi
},
data () {
return {
}
},
methods:{
say(){
alert("hi");
}
}
}
</script>
全局指令
import hi from "i-am-here";
import Vue from "vue";
Vue.directive(hi.name,hi);
传值 option
callback
当绑定元素出现在视图中时,触发的回调函数,也可以将option直接传入一个函数。
offset
当元素的上边框距离可视区域下边框达到这个值,才会触发回调,默认值为0。
rollEl
可滚动的元素,默认会监听window的滚动事件。
修饰符
once 是否只触发一次
1.0.0
6 years ago