In my Vue component, I am working on passing a route parameter through XHR requests and potentially using it in other areas as well. Initially, I considered storing it as a data attribute but realized that it could be modified by someone.
Then it occurred to me that since the route for the current screen will remain static (any changes might lead to a different screen or a 404 error), I could create a computed property. By doing so, I can ensure that it is not recomputed, essentially creating a constant reference accessible as this.ID_A
. Are there alternative methods to achieve this consistency?
computed: {
ID_A() {
return this.$route.params.id_a;
}
}