diff --git a/src/views/Root.vue b/src/views/Root.vue index 43dda41..6d54ba3 100644 --- a/src/views/Root.vue +++ b/src/views/Root.vue @@ -10,10 +10,12 @@ import Intro from '../texts/intro.md' const router = useRouter() const err = ref(false) +const srcText = ref(null) function convert(from) { if( Number(from) ) { return { + type: 's', id: Number(from) } } else if (from.includes('https://archiveofourown.org/works/')) { @@ -34,9 +36,11 @@ function convert(from) { } function onConvert(data) { - const { id, cid } = convert(data.src) - if (id == null) { + const { type, id, cid } = convert(data.src) + console.log(type, id, cid) + if (type == null) { err.value = true + srcText.value?.focus() } else { err.value = false if (cid) router.push(`/work/${id}/${cid}`) @@ -54,7 +58,7 @@ function onConvert(data) {

链接转换

输入完整链接或者 ID

- + 链接格式错误!