Data Option breaking
- BREAKING: component option declaration no longer accepts a plain JavaScript
object
and expects afunction
declaration.
For example:
In 3.x, the data
option has been standardized to only accept a that returns an object
.
import { createApp } from 'vue'
createApp({
data() {
}
}
}).mount('#app')
</script>
For users relying on the object declaration, we recommend:
- Extracting the shared data into an external object and using it as a property in
data