<script setup>
// 带有下划虚线的链接

import {ref} from "vue";

const props = defineProps(["href", "title"])
const emits = defineEmits(["click.prevent"])
const {vHref} = (function () {
	let href = props.href
	if (href == null) {
		href = ""
	}
	return {
		vHref: ref(href)
	}
})()

const clickPrevent = function (...allArgs) {
	emits("click.prevent", ...allArgs)

	if (vHref.value.length > 0) {
		// TODO 在弹窗中就直接弹出新的弹窗
		window.location = vHref.value
	}
}

</script>

<template>
	<a :href="vHref" :title="title" style="border-bottom: 1px #db2828 dashed" @click.prevent="clickPrevent"><span class="red"><slot></slot></span></a>
</template>

<style scoped>

</style>