Vue 实例选项


Vue 中的选项是我们在使用 Options API 时在 Vue 实例上可用的不同选项。

Option Description
data contains the data properties we set up and their initial values
methods contains the methods we write
computed contains the computed properties we make, that are used as data properties, but are written like functions with a return and no arguments, and gets called whenever a dependency is changed
watch contains the watchers we make, which are like functions that get called whenever a data property with the same name is changed
props contains the props of a component, that are used as custom attributes by the parent component
emits contains the emits of a component, the custom events a component emits to its parent component
expose contains a list of public properties. Properties that are not exposed, are kept private to the component