|
@@ -1,28 +1,58 @@
|
|
<template>
|
|
<template>
|
|
<div id="app">
|
|
<div id="app">
|
|
- <img alt="Vue logo" src="./assets/logo.png">
|
|
|
|
- <HelloWorld msg="Welcome to Your Vue.js App"/>
|
|
|
|
|
|
+ <input v-model="day" />
|
|
|
|
+ <div @click="showMsg" ref="aaa">标签</div>
|
|
|
|
+ <Demo2 name="LiLi" sex="女" :age="20"></Demo2>
|
|
|
|
+ <!--
|
|
|
|
+ 组件通信:
|
|
|
|
+ 父组件 template标签中 ref="名称<aaa>"
|
|
|
|
+ mounted() this.$refs.aaa.$on("自定义的方法名<xx>",传送的方法)
|
|
|
|
+ -->
|
|
|
|
+ <Demo1 ref="getMain"></Demo1>
|
|
|
|
+ <!-- <button >按钮</button> -->
|
|
</div>
|
|
</div>
|
|
</template>
|
|
</template>
|
|
|
|
|
|
<script>
|
|
<script>
|
|
-import HelloWorld from './components/HelloWorld.vue'
|
|
|
|
-
|
|
|
|
|
|
+import Demo1 from './components/Demo1.vue';
|
|
|
|
+import Demo2 from './components/Demo2.vue';
|
|
export default {
|
|
export default {
|
|
- name: 'App',
|
|
|
|
- components: {
|
|
|
|
- HelloWorld
|
|
|
|
- }
|
|
|
|
|
|
+ name:"App",
|
|
|
|
+ data() {
|
|
|
|
+ return {
|
|
|
|
+ day:"星期三",
|
|
|
|
+ happy:"开心"
|
|
|
|
+ }
|
|
|
|
+ },
|
|
|
|
+ components:{
|
|
|
|
+ Demo1,
|
|
|
|
+ Demo2
|
|
|
|
+ },
|
|
|
|
+ created() {
|
|
|
|
+ console.log(this.day)
|
|
|
|
+ },
|
|
|
|
+ methods: {
|
|
|
|
+ aa() {
|
|
|
|
+ console.log("成功了")
|
|
|
|
+ },
|
|
|
|
+ showMsg() {
|
|
|
|
+ console.log(this.$refs.aaa,'ref属性')
|
|
|
|
+ }
|
|
|
|
+ },
|
|
|
|
+ mounted() {
|
|
|
|
+ this.$refs.getMain.$on("aab",this.aa)
|
|
|
|
+ // console.log(this.$refs.xxx)
|
|
|
|
+ },
|
|
}
|
|
}
|
|
</script>
|
|
</script>
|
|
|
|
|
|
<style>
|
|
<style>
|
|
-#app {
|
|
|
|
|
|
+/* #app {
|
|
font-family: Avenir, Helvetica, Arial, sans-serif;
|
|
font-family: Avenir, Helvetica, Arial, sans-serif;
|
|
-webkit-font-smoothing: antialiased;
|
|
-webkit-font-smoothing: antialiased;
|
|
-moz-osx-font-smoothing: grayscale;
|
|
-moz-osx-font-smoothing: grayscale;
|
|
text-align: center;
|
|
text-align: center;
|
|
color: #2c3e50;
|
|
color: #2c3e50;
|
|
margin-top: 60px;
|
|
margin-top: 60px;
|
|
-}
|
|
|
|
|
|
+} */
|
|
</style>
|
|
</style>
|