I use vue@2.1.3 and the official vue web template to create the application.
When developing locally, I often see the Uncaught TypeError: Cannot read property ... of undefined warning, but HTML can be done successfully. However, HTML cannot be displayed when deployed to Netlify using the npm run build . Therefore, I must take this warning seriously.
I learned from here that this is because "the data is not complete when rendering the component, but, for example, it is loaded from the API." and the solution is to "use v-if to display this part of the template only after the data has been downloaded."
There are two questions:
- I tried wrap
v-if around several operators that generate a warning, but personal, I think this solution is detailed. Is there a neat approach? - “warnings” in local development turn into “fatal errors” (HTML cannot be visualized) during production. How to make them the same? for example, both of them give warnings or errors?
source share