[Vue warn]: injected property "formItemEmitter" is a ref and will be auto-unwrapped and no longer needs
.value
in the next minor release. To opt-in to the new behavior now, setapp.config.unwrapInjectedRef = true
(this config is temporary and will not be needed in the future.)
父组件通过provide注入一个对象,为了保持响应式,写法如下
provide () {
return {
formItemEmitter: computed(() => this.thisEmitter)
};
},
后代组件通过inject来使用的时候必须要加一层.value
,这样使用的时候就会出现上面的警告
当我加上app.config.unwrapInjectedRef = true
配置的时候
通过option api形式写的代码不加.value
没问题,但是在setup中const formItemEmitter = inject('formItemEmitter');
就报错了,断点一看还是有一层value在