feat: add link for individual props/events/slots/configs/icons
This commit is contained in:
27
plugins/target.js
Normal file
27
plugins/target.js
Normal file
@@ -0,0 +1,27 @@
|
||||
export default ({ app }) => {
|
||||
let target
|
||||
|
||||
document.documentElement.addEventListener('click', () => {
|
||||
if (!target) {
|
||||
return
|
||||
}
|
||||
|
||||
delete target.dataset.target
|
||||
})
|
||||
|
||||
app.router.afterEach(to => {
|
||||
if (!to.hash) {
|
||||
return
|
||||
}
|
||||
|
||||
setTimeout(() => {
|
||||
const selector = decodeURIComponent(to.hash)
|
||||
const anchor = document.querySelector(selector)
|
||||
|
||||
if (anchor.tagName === 'CODE') {
|
||||
target = anchor.closest('tr')
|
||||
target.dataset.target = ''
|
||||
}
|
||||
}, 0)
|
||||
})
|
||||
}
|
||||
Reference in New Issue
Block a user