1.寫子組件時候在子組件上寫上ref屬性
<child-first ref="first" ></child-first>
2.調用子組件的方法或者data
//調用方法 還能獲取返回值 let childData = this.$refs.first.getData(); //直接獲取子組件的值 console.log(this.$refs.first.res)
注意:這個“first”是唯一標識 上下要一致
1.寫子組件時候在子組件上寫上ref屬性
<child-first ref="first" ></child-first>
2.調用子組件的方法或者data
//調用方法 還能獲取返回值 let childData = this.$refs.first.getData(); //直接獲取子組件的值 console.log(this.$refs.first.res)
注意:這個“first”是唯一標識 上下要一致
本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。