$options
用于当前组件实例的初始化选项。
类型
interface ComponentPublicInstance { $options: ComponentOptions }
细节
该$options对象公开了当前组件的已解析选项,并且是这些可能来源的合并结果:
- 全局混入mixins
- 组件extends基础
- 组件混入mixins
它通常用于支持自定义组件选项:
const app = createApp({ customOption: 'foo', created() { console.log(this.$options.customOption) // => 'foo' } })