-
Notifications
You must be signed in to change notification settings - Fork 22
Vue Composition API: Watchers
Declan Coughlan edited this page May 30, 2023
·
3 revisions
import { Watch } from "vue-property-decorator";
@Watch("ticketIsProcessed")
private onTicketIsProcessedChanged(value: boolean): void {
if (value) {
this.redirect();
}
}
import { watch } from "vue";
watch(ticketIsProcessed, (value: boolean) => {
if (value) {
redirect();
}
});
When watching complex objects, and the trigger should only be attached to changes of a particular property, such as route.value.query
when using useRoute()
. You can use a resolver function to target the property you're interested in watching.
watch(
() => route.value.query,
(value) => {
if (value.registration === "success") {
router.replace({ query: {} });
appTourComponent.value?.showModal();
}
});
-
Developer Standard and Processes
-
Workstation Setup
-
IDE Configuration
-
Application Config
-
RedHat SSO Authorization Server
-
Known Issues