Currently, I am developing an Ionic WebApp using Vue and TypeScript. My current task involves retrieving the current id parsed by the route. To achieve this, I have been working on a watcher:
export default {
data() {
return {
productId: null,
};
},
watch: {
$route(currentRoute: any) {
this.productId = currentRoute.params.id;
},
},
};
However, I encountered the following error message:
[vue-cli-service] TS2339: Property 'productId' does not exist on type '{ $route(currentRoute: any): void; }'.
[vue-cli-service] 14 | watch: {
[vue-cli-service] 15 | $route(currentRoute: any) {
[vue-cli-service] > 16 | this.productId = currentRoute.params.id;
[vue-cli-service] | ^^^^^^^^^
[vue-cli-service] 17 | },
[vue-cli-service] 18 | },
[vue-cli-service] 19 | };
I have already attempted using the handler notation without success. Does anyone else have a suggestion to resolve this issue?