I want to use the value of the child component in the computed of the parent component. Is there anything I can do? Or the parent component uses the value of the computed of the child component

I want to use the value of the child component in the computed of the parent component. Is there anything I can do?

Mar.28,2021

declare the value you need in the data of the parent component to store the value of the child component;
because of the problem with the mounting order of the parent component, the data of the child component has not been initialized when the parent component data declares it;
so you need to get this value through this.$refs.xxxx.xxxx in the parent component mounted and assign it to the value in data.
the computed of the parent recalculates the value of


child component based on the value in this data. The emit event modifies the data, of the parent component, and then executes computed, to recommend the data of the watch parent component

according to the requirements.
Menu