0👍
That is because computed properties are cached based on their reactive dependencies
Reference: Computed Property and Caching
- [Vuejs]-Shared session between laravel and vue apps
- [Vuejs]-Vue Js 3: Use Prop default value as Template String
0👍
In Paragraph 1, you are binding a string value to the style attribute.
In Paragraph 2, you are binding an object value to the style attribute.
For string values, the browser will parse the style attribute and immediately update the rendering. If an invalid property or invalid property-value is added, CSS will ignore it.
For object values, Vue will dynamically update the style properties using the object key-value pairs. If an invalid value is encountered, it will ignore the property and avoid updating it through JavaScript. This is why the background color stays blue.
Vue handles style objects using JavaScript, for example:
document.querySelector("p").style.backgroundColor = "blue";
document.querySelector("p").style.backgroundColor = "blu"; // this will be ignored, it will not 'reset' the value to a blank state
- [Vuejs]-REST API call works from terminal with curl but I get 404 in browser from my Vue / axios app
- [Vuejs]-Table data rendering