Skip to content

Instantly share code, notes, and snippets.

@wicksome
Created December 20, 2018 11:21
Show Gist options
  • Save wicksome/727d5f81150579d1625f8be40ca57f3d to your computer and use it in GitHub Desktop.
Save wicksome/727d5f81150579d1625f8be40ca57f3d to your computer and use it in GitHub Desktop.
Bind router state to the radio button in vue
<template>
<input
:checked="$route.name === 'groups'"
type="radio"
@change="$router.push({name: 'groups'})"
>
<input
:checked="$route.name === 'groups-member'"
type="radio"
@change="$router.push({name: 'groups-member'})"
>
<input
:checked="$route.name === 'groups-master'"
type="radio"
@change="$router.push({name: 'groups-master'})"
>
</template>
<script>
export default {
name: "RadioButtonBindWithRoute",
}
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment