在vue中,父子組件傳參數
在子組件中,獲取 父組件的參數,傳遞方法
父組件中的子標簽 <son :parent="this" @comfirmParam="getFilterData" >子組件</son> data() { return { name:"黑波利" }; }, methods: { getFilterData(params) { console.log(params); }, }, 子組件中的代碼 <button @click="click"><button> <script> export default { props: ["parent"], data() { return { params: { name: "小熊" }, }; }, methods: { click() { this.$emit("comfirmParam", this.params); console.log(this.parent.name) }, }, }; </script>