/
githubmirror
/
vue-element-admin
Обзор
Документация
Войти
/
githubmirror
/
vue-element-admin
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
master
src/layout/components/Sidebar/Link.vue
43 строки
657 B
花裤衩
fix: compatibility with vetur (#1700)
04 май 2020, 16:30
Не верифицирован
04 май 2020, 16:30
fc26c31
Код
Авторство
О чём код?
<template> <component :is="type" v-bind="linkProps(to)"> <slot /> </component> </template> <script> import { isExternal } from '@/utils/validate' export default { props: { to: { type: String, required: true } }, computed: { isExternal() { return isExternal(this.to) }, type() { if (this.isExternal) { return 'a' } return 'router-link' } }, methods: { linkProps(to) { if (this.isExternal) { return { href: to, target: '_blank', rel: 'noopener' } } return { to: to } } } } </script>