vue-link-interceptor
v0.1.2
Published
Vue 3 plugin to intercept all <a> tag clicks in your SPA — handle internal routing and external link modifications with ease.
Maintainers
Readme
vue-link-interceptor
Vue 3 plugin to intercept all <a> tag clicks in your SPA. Handle internal routing and external link modifications with ease.
Install
npm install vue-link-interceptorUsage
import { linkInterceptorPlugin } from 'vue-link-interceptor'
app.use(linkInterceptorPlugin, {
onInternalLink(ctx) {
ctx.preventDefault()
router.push(ctx.path)
},
onExternalLink(ctx) {
ctx.url.searchParams.set('utm_source', 'myapp')
},
})Docs & Playground
https://babu-ch.github.io/link-interceptor/?fw=vue
