|
@@ -10,12 +10,18 @@
|
|
|
-->
|
|
|
<Demo1 ref="getMain"></Demo1>
|
|
|
<!-- <button >按钮</button> -->
|
|
|
+ <hr>
|
|
|
+ <Demo3 ref="getThing"></Demo3>
|
|
|
+ <hr>
|
|
|
+ <Demo4 @getName="getName"></Demo4>
|
|
|
</div>
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
import Demo1 from './components/Demo1.vue';
|
|
|
import Demo2 from './components/Demo2.vue';
|
|
|
+import Demo3 from './components/Demo3.vue';
|
|
|
+import Demo4 from './components/Demo4.vue';
|
|
|
export default {
|
|
|
name:"App",
|
|
|
data() {
|
|
@@ -26,7 +32,9 @@ export default {
|
|
|
},
|
|
|
components:{
|
|
|
Demo1,
|
|
|
- Demo2
|
|
|
+ Demo2,
|
|
|
+ Demo3,
|
|
|
+ Demo4
|
|
|
},
|
|
|
created() {
|
|
|
console.log(this.day)
|
|
@@ -37,11 +45,18 @@ export default {
|
|
|
},
|
|
|
showMsg() {
|
|
|
console.log(this.$refs.aaa,'ref属性')
|
|
|
+ },
|
|
|
+ showMain() {
|
|
|
+ alert("看屏幕")
|
|
|
+ },
|
|
|
+ getName(name) {
|
|
|
+ console.log(name + '吃的真香');
|
|
|
}
|
|
|
},
|
|
|
mounted() {
|
|
|
this.$refs.getMain.$on("aab",this.aa)
|
|
|
// console.log(this.$refs.xxx)
|
|
|
+ this.$refs.getThing.$on("happy",this.showMain)
|
|
|
},
|
|
|
}
|
|
|
</script>
|