mirror of
https://github.com/chatopera/cosin.git
synced 2025-08-01 16:38:02 +08:00
add: isUrl
Signed-off-by: Kaifuny <superbiger.github@gmail.com>
This commit is contained in:
parent
0a91e3c543
commit
6a7b0472af
@ -2,6 +2,7 @@
|
|||||||
import { ref } from 'vue'
|
import { ref } from 'vue'
|
||||||
import { RouterLink, RouterView, useRouter } from 'vue-router'
|
import { RouterLink, RouterView, useRouter } from 'vue-router'
|
||||||
import { Nav } from '@cskefu/shared-ui'
|
import { Nav } from '@cskefu/shared-ui'
|
||||||
|
import { isUrl } from '@cskefu/shared-utils'
|
||||||
import { ROUTE_NAME } from '@cskefu/models'
|
import { ROUTE_NAME } from '@cskefu/models'
|
||||||
|
|
||||||
import {
|
import {
|
||||||
@ -71,11 +72,12 @@ switch (path) {
|
|||||||
const router = useRouter()
|
const router = useRouter()
|
||||||
|
|
||||||
function handleClickNav(name: string) {
|
function handleClickNav(name: string) {
|
||||||
if (name.startsWith('https://') || name.startsWith('http://')) {
|
if (isUrl(name)) {
|
||||||
window.open(name, '_blank')
|
window.open(name, '_blank')
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
if (name === 'logout') {
|
if (name === 'logout') {
|
||||||
|
// todo
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
router.push({ name })
|
router.push({ name })
|
||||||
|
@ -1 +1,2 @@
|
|||||||
export * from './routes'
|
export * from './routes'
|
||||||
|
export * from './is'
|
||||||
|
3
contact-frontend/packages/shared/utils/src/is.ts
Normal file
3
contact-frontend/packages/shared/utils/src/is.ts
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
export function isUrl(url: string) {
|
||||||
|
return url.startsWith('https://') || url.startsWith('http://')
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user