fix: 增加相对路径跳转

This commit is contained in:
huanghao1412 2024-08-17 11:07:50 +08:00
parent d6d626a5c4
commit 60befc3362
4 changed files with 12 additions and 6 deletions

4
.env
View File

@ -3,9 +3,9 @@ VITE_DEV_PORT = '8080'
# development path
# VITE_DEV_PATH = 'http://192.168.0.34:11887'
VITE_DEV_PATH = 'http://192.168.0.34:8102/'
VITE_DEV_PATH = 'http://114.115.222.135:9015/'
# VITE_DEV_PATH = 'http://192.168.0.120:3001'
VITE_DEV_TOKEN = '09c7cb6a-ab85-4c92-ad0f-5a25d72d71f7'
VITE_DEV_TOKEN = 'a170d26c-477f-4b17-a344-997a20d3bab0'
# production path
VITE_PRO_PATH = 'http://192.168.0.235:8177'

View File

@ -395,7 +395,7 @@ export interface commonDataType {
// customEvent事件
export interface CustomEventType {
click: {
linkHead: 'http://' | 'https://'
linkHead: 'http://' | 'https://' | '/'
link: string
isBlank: boolean
}

View File

@ -69,21 +69,24 @@ const showModal = ref(false)
// init()
// })
const linkHeadOptions = ['http://', 'https://'].map(_ => ({label: _, value: _}))
const linkHeadOptions = ['http://', 'https://', '/'].map(_ => ({label: _, value: _}))
const finallyLink = computed(() => {
return targetData.value.customEvent.click.linkHead + (targetData.value as any).customEvent.click.link
})
const handleClick = () => {
if(!finallyLink.value) return
let isRelativePath = targetData.value.customEvent.click.linkHead === '/'
if(targetData.value.customEvent.click.isBlank) postMessageToParent({
type: 'windowOpen',
url: finallyLink.value,
openNew: true
openNew: true,
isRelativePath
})
else postMessageToParent({
type: 'windowOpen',
url: finallyLink.value,
isRelativePath
})
}
</script>

View File

@ -7,14 +7,17 @@ const bindEvent = (item:any) => {
obj = {
click: () => {
if(!link) return
let isRelativePath = linkHead === '/'
if(isBlank) postMessageToParent({
type: 'windowOpen',
url: `${linkHead}${link}`,
openNew: true
openNew: true,
isRelativePath
})
else postMessageToParent({
type: 'windowOpen',
url: `${linkHead}${link}`,
isRelativePath
})
}
}