I want to get the row child component data object on the parent component
<ct-select
v-model="text"
@getSearchName="getName">
<ct-option
v-for="(item, index) of dataList"
:key="index"
:value="item.value"
:label="item.label">
</ct-option>
</ct-select>
under mounted
in ct-select
, use this.$slots.default
to get undefined
, because dataList
is obtained asynchronously
//ct-select
export default {
mounted() {
console.log(this.$slots.default) //undefined
}
}
is there any way to get data objects on subcomponents in mounted
asynchronously?
Supplementary questions
actually I want to do something similar to the elementUi drop-down option
the reason why I do this is to get the data in the child component on the parent component for page conversion.
because I made such a plug-in without thinking about it before, but found that
is not flexible when giving values, so I want to change it to the same function as elementui
, but I read the source code of elementui
, but I am a little confused
<el-select v-model="value" placeholder="">
<el-option
v-for="item in options"
:key="item.value"
:label="item.label"
:value="item.value">
</el-option>
</el-select>