拦截各处的a标签点击事件:ai配置弹窗、节点备注浮层、节点备注编辑弹窗

This commit is contained in:
街角小林 2025-03-04 11:23:04 +08:00
parent d234993228
commit 7cc7b31e31
4 changed files with 52 additions and 5 deletions

View File

@ -15,7 +15,12 @@
>
<p class="title">{{ $t('ai.VolcanoArkLargeModelConfiguration') }}</p>
<p class="desc">
{{ $t('ai.configTip') }}<a href="https://mp.weixin.qq.com/s/JNb7PH4sCjWzIZ9G8wStGQ" target="_blank">{{ $t('ai.course') }}</a
{{ $t('ai.configTip')
}}<a
@click.stop.prevent="
openUrl('https://mp.weixin.qq.com/s/JNb7PH4sCjWzIZ9G8wStGQ')
"
>{{ $t('ai.course') }}</a
>
</p>
<el-form-item label="API Key" prop="key">
@ -155,6 +160,10 @@ export default {
this.$message.success(this.$t('ai.configSaveSuccessTip'))
}
})
},
openUrl(url) {
window.electronAPI.openUrl(url)
}
}
}
@ -169,6 +178,7 @@ export default {
.aiConfigBox {
a {
color: #409eff;
cursor: pointer;
}
.title {

View File

@ -13,9 +13,18 @@
<p>
{{ $t('ai.connectFailedCheckTip1')
}}<a
href="https://pan.baidu.com/s/1huasEbKsGNH2Af68dvWiOg?pwd=3bp3"
@click.stop.prevent="
openUrl(
'https://pan.baidu.com/s/1huasEbKsGNH2Af68dvWiOg?pwd=3bp3'
)
"
>{{ $t('ai.baiduNetdisk') }}</a
><a href="https://github.com/wanglin2/mind-map/releases">Github</a>
><a
@click.stop.prevent="
openUrl('https://github.com/wanglin2/mind-map/releases')
"
>Github</a
>
</p>
<p>{{ $t('ai.connectFailedCheckTip2') }}</p>
<P>{{ $t('ai.connectFailedCheckTip3') }}</P>
@ -538,6 +547,10 @@ export default {
this.isAiCreating = false
this.aiInstance = null
}
},
openUrl(url) {
window.electronAPI.openUrl(url)
}
}
}

View File

@ -13,7 +13,13 @@
v-model="note"
>
</el-input> -->
<div class="noteEditor" ref="noteEditor" @keyup.stop @keydown.stop></div>
<div
class="noteEditor"
ref="noteEditor"
@keyup.stop
@keydown.stop
@click="onClick"
></div>
<!-- <div class="tip">换行请使用Enter+Shift</div> -->
<span slot="footer" class="dialog-footer">
<el-button @click="cancel">{{ $t('dialog.cancel') }}</el-button>
@ -115,6 +121,17 @@ export default {
}
this.cancel()
},
onClick(e) {
if (e.target.tagName.toLowerCase() === 'a') {
e.stopPropagation()
e.preventDefault()
const url = e.target.href
if (url) {
window.electronAPI.openUrl(url)
}
}
}
}
}

View File

@ -75,7 +75,14 @@ export default {
handleALink() {
const list = this.$refs.noteContentViewer.querySelectorAll('a')
Array.from(list).forEach(a => {
a.setAttribute('target', '_blank')
a.addEventListener('click', e => {
e.stopPropagation()
e.preventDefault()
const url = a.href
if (url) {
window.electronAPI.openUrl(url)
}
})
})
},