In Vue, provide can pass values to child components
provide('data',ref("I am data for child components"))
Subcomponents can use inject to get the value.
How to get the data in the parent component? ?
In Vue, provide can pass values to child components
provide('data',ref("I am data for child components"))
Subcomponents can use inject to get the value.
How to get the data in the parent component? ?
Normal pass by value:
it and the child component can get it too
Transfer Function:
Sub:
let getData = inject('data',data)datais a function, you cangetData('data for father')