fix: EncodeURIComponent for dynamic name route (#42)

This commit is contained in:
Jacob Clevenger 2021-01-24 05:59:56 -05:00 committed by GitHub
parent a4d1512449
commit c2fd738565
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -8,7 +8,7 @@ const name = ref('')
const router = useRouter() const router = useRouter()
const go = () => { const go = () => {
if (name.value) if (name.value)
router.push(`/hi/${name.value}`) router.push(`/hi/${encodeURIComponent(name.value)}`)
} }
const { t } = useI18n() const { t } = useI18n()
@ -36,7 +36,7 @@ const { t } = useI18n()
:placeholder="t('intro.whats-your-name')" :placeholder="t('intro.whats-your-name')"
type="text" type="text"
autocomplete="false" autocomplete="false"
class="px-4 py-2 border border-gray-200 rounded text-center text-sm outline-none active:outline-none bg-transparent dark:border-gray-700" class="px-4 py-2 text-sm text-center bg-transparent border border-gray-200 rounded outline-none active:outline-none dark:border-gray-700"
style="width: 250px" style="width: 250px"
@keydown.enter="go" @keydown.enter="go"
> >
@ -44,7 +44,7 @@ const { t } = useI18n()
<div> <div>
<button <button
class="btn m-3 text-sm" class="m-3 text-sm btn"
:disabled="!name" :disabled="!name"
@click="go" @click="go"
> >