My component looks like this so I can handle the first route load for a component and subsequent ones when the route param changes:
<script setup>
import {onBeforeRouteUpdate, useRoute} from "vue-router";
import {ref} from "vue";
const id = ref(useRoute().params.equipmentId)
onBeforeRouteUpdate(async (to, from) => {
id.value = to.params.equipmentId
})
</script>
Is there a shorter, idiomatic way to do this so I don’t have to handle the “one off” case of getting the initial value?