2021-09-09 05:16:10 +08:00
|
|
|
|
<template>
|
|
|
|
|
<span class="openlink" @click="onClickhandle">
|
|
|
|
|
<slot></slot>
|
|
|
|
|
</span>
|
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
<script>
|
|
|
|
|
export default {
|
|
|
|
|
name: "OpenLink",
|
|
|
|
|
props: {
|
|
|
|
|
href: String,
|
|
|
|
|
},
|
|
|
|
|
setup(props) {
|
|
|
|
|
const onClickhandle = () => {
|
|
|
|
|
// You cannot use the a tag directly, you need to call the Go method here to open the link using the default browser.
|
|
|
|
|
// 不能直接使用a标签,需要在这里调用Go方法以使用默认浏览器打开链接。
|
|
|
|
|
|
2021-11-15 03:07:00 +08:00
|
|
|
|
window.runtime.BrowserOpenURL(props.href);
|
|
|
|
|
};
|
2021-09-09 05:16:10 +08:00
|
|
|
|
|
|
|
|
|
return {
|
2021-11-15 03:07:00 +08:00
|
|
|
|
onClickhandle,
|
|
|
|
|
};
|
|
|
|
|
},
|
2021-09-09 05:16:10 +08:00
|
|
|
|
};
|
|
|
|
|
</script>
|
|
|
|
|
|
2021-09-09 18:39:31 +08:00
|
|
|
|
<style lang="scss">
|
|
|
|
|
.openlink {
|
|
|
|
|
cursor: pointer;
|
|
|
|
|
text-decoration: underline;
|
2021-09-09 05:16:10 +08:00
|
|
|
|
}
|
|
|
|
|
</style>
|