
Security News
Browserslist-rs Gets Major Refactor, Cutting Binary Size by Over 1MB
Browserslist-rs now uses static data to reduce binary size by over 1MB, improving memory use and performance for Rust-based frontend tools.
@sensorskit/vue-input-binding
Advanced tools
用神策追踪输入框的聚焦失焦事件
事件 属性 InputFocus InputLabel? InputBlur InputLabel?, StayTime, StayMSTime
yarn add @sensorskit/vue-input-binding
在 Vue.js 项目的入口处引入:
import VueInputBinding from '@sensorskit/vue-input-binding'
Vue.use(VueInputBinding)
// 如果需要自定义选项
Vue.use(VueInputBinding, {
sa: window.sa // 神策 JS SDK 暴露的全局变量
})
在需要自动触发聚焦失焦事件的地方引入自定义指令:
<!-- 此时会自动触发神策的聚焦失焦事件,并带上必要属性,需要在引入时配置 sa 全局变量 -->
<input type="text" data-label="手机号" v-sa-track>
如果在元素上设置了 data-label
属性,触发神策事件时会自动带上 InputLabel 属性。
如果需要自行处理聚焦失焦逻辑:
<input type="text" v-on-focus="onFocus" v-on-blur="onBlur">
此时,数据框聚焦时会触发 onFocus 方法,失焦时会触发 onBlur 方法,onBlur 会接收一个参数:
export default {
...
methods: {
onFocus() {
sa.track('InputFocus', { ...your custom properties })
},
// onBlur 接收一个 Object 参数,里面包含距离上次聚焦的停留时间:StayTime, StayMSTime
onBlur({ StayTime, StayMSTime }) {
sa.track('InputBlur', {
...your custom properties,
StayMSTime, // 毫秒
StayTime // 秒
})
}
}
}
FAQs
vue custom directive for focus and blur binding
The npm package @sensorskit/vue-input-binding receives a total of 3 weekly downloads. As such, @sensorskit/vue-input-binding popularity was classified as not popular.
We found that @sensorskit/vue-input-binding demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
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.
Security News
Browserslist-rs now uses static data to reduce binary size by over 1MB, improving memory use and performance for Rust-based frontend tools.
Research
Security News
Eight new malicious Firefox extensions impersonate games, steal OAuth tokens, hijack sessions, and exploit browser permissions to spy on users.
Security News
The official Go SDK for the Model Context Protocol is in development, with a stable, production-ready release expected by August 2025.