I want to use the value of the child component in the computed of the parent component. Is there anything I can do?
I want to use the value of the child component in the computed of the parent component. Is there anything I can do?
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.my code has bug, and then I checked to write = = as = . A [1,2,3,4,5,6,7] B [2,3,4] after deletion A [1,5,6,7] this.selectRightTableData.forEach(item => { this.rightTableData.splice(this.rightTableData.findIndex(v => v.id = item.id...
solution: defines a temporary variable, but it needs to be hidden, otherwise it will be displayed <span v-show="false"> {{message = chat.messages[chat.messages.length-1]}} < span> {{message.content}} similar...
change(id) { this.childMenu = this.menu[this.menu.findIndex(menu=> menu.id === id)].data } this way of writing is very confusing. what s the principle? menu = > menu.id = id in findIndex what do you get? Is it a subscript? I m confused abou...