A strange question about the props data of the Vue subcomponent.

I wanted to encapsulate a table component with search function myself, so I created a subcomponent tableWithSearch

< template >

{{tableData}} <!-- a.-->
<div>
    <table :column="tableColumn" :data="tableDataAfterSearch"></table>
<div> </template> <script>
export defualt{
    props:{
        tableColumn:{
            required:true
        },
        tableData:{
            required:true
        }
    },
     methods:{
         initData(){
             //tableDatatableDataAfterSearch
             console.log(this.tableData) //b.shu"chu
         }
     }
} </script>

< / template >

in the parent component, axios is used to obtain data from the background during mounted, and then this.$ref.searchTable is used to call the init method of the child component. As a result, the output from an is the normal background value and the output at b is empty. Add a button to the parent component, and when the button triggers the function of fetching the number, the ab will have normal numbers in both places.
what is this all about?

Mar.21,2022

computed: {
tableDataAfterSearch () {

return    this.tableData

}
}


adds that the problem is that the parent component asynchronously gets the data value and passes it to the child component. So use the second sub-component to listen to the data with watch, and make the corresponding change once there is a change

Menu