Research
Security News
Malicious npm Packages Inject SSH Backdoors via Typosquatted Libraries
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
github.com/Desdesdesgo/vue-scrollwatch
scrollwatch features:
特性:
learning usage from src/views/page1.vue and page2.vue
查看源码中的src/views/page1.vue and page2.vue 获得详细使用方式
npm install --save vue-scrollwatch
in main.js
import vueScrollwatch from "vue-scrollwatch"
Vue.use(vueScrollwatch)
导航
nav
<ul>
<li @click="scrollTo('a')">section 1</li>
<li @click="scrollTo('b')">section 2</li>
<li @click="scrollTo('c')">section 3</li>
<li @click="scrollTo('d')">section 4</li>
</ul>
element to watch
<div class="section" v-scrollWatch="{name:'a',offset:0,callback:spyDomChange}">scetcion 1</div>
<div class="section" v-scrollWatch="{name:'b',offset:0,callback:spyDomChange}">scetcion 2</div>
<div class="section" v-scrollWatch="{name:'c',offset:0,callback:spyDomChange}">scetcion 3</div>
<div class="section" v-scrollWatch="{name:'d',offset:0,callback:spyDomChange}">scetcion 4</div>
callback
and scrollTo
in methods
import scrollWatch from "vue-scrollwatch"
export default {
...
methods:{
spyDomChange(node) {
if (this.activeMenu != node.name)
this.activeMenu = node.name
},
scrollTo(name){
scrollWatch.scrollTo(name)
}
}
...
}
if you want to define a container to scroll (not window)
如果你想指定滚动容器,而不是window
<div id="scrollDom">
<div class="section" v-scrollWatch="{name:'a',offset:0,callback:spyDomChange}">scetcion 1</div>
<div class="section" v-scrollWatch="{name:'b',offset:0,callback:spyDomChange}">scetcion 2</div>
<div class="section" v-scrollWatch="{name:'c',offset:0,callback:spyDomChange}">scetcion 3</div>
<div class="section" v-scrollWatch="{name:'d',offset:0,callback:spyDomChange}">scetcion 4</div>
<div>
import scrollWatch from "vue-scrollwatch"
export default {
...
created(){
scrollWatch.setContainer("#scrollDom")
}
...
}
you also can use class as selector
你也可以使用 class 来作为css 选择器
container and element to be watch hasn't to be father and sons,it also can be grandfather or grand-grandfather
滚动容器和监听元素之间不一定是父子关系,可以是爷孙关系,也可以是祖宗孙子关系
required: true
元素位置偏移
default: 0
type: function
npm run dev
FAQs
Unknown package
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.