父:
<template> <div class="contain"> <active-block @handClick="click1()" :title="titleMsg1" :content="comtentMsg1" isShow=true :buttonMsg="buttonMsg1"></active-block> <active-block @handClick="click2()" :title="titleMsg2" :content="comtentMsg2" :buttonMsg="buttonMsg2" ></active-block> </div> </template>
methods:{ click1(){ alert(1); }, click2(){ alert(2) } }
子:
<template> <div> <div class="border-grey p-8 p-left-right-18 border_radius_20 m-right-10 orange border_orange" @click="handle1()">{{buttonMsg}}</div> </div> </template> <script> export default { name: "activeBlock", props:['title','content','isShow','buttonMsg','handle'], methods:{ handle1(){ this.$emit('handClick') } } } </script>