mirror of
https://github.com/koel/koel
synced 2024-12-20 09:33:23 +00:00
9 lines
311 B
TypeScript
9 lines
311 B
TypeScript
import { Directive } from 'vue'
|
|
|
|
const setTargetBlank = (el: HTMLElement) => Array.from(el.getElementsByTagName('a'))
|
|
.forEach(a => a.setAttribute('target', '_blank'))
|
|
|
|
export const newTab: Directive = {
|
|
mounted: (el: HTMLElement) => setTargetBlank(el),
|
|
updated: (el: HTMLElement) => setTargetBlank(el)
|
|
}
|