commit | author | age | ||
bf6fbe | 1 | <template> |
L | 2 | <div> |
3 | <component-a ref="comA"></component-a> | |
4 | </div> | |
5 | </template> | |
6 | <script> | |
7 | import componentA from "./B.vue" | |
8 | export default { | |
9 | components: { | |
10 | componentA | |
11 | }, | |
12 | mounted() { | |
13 | const comA = this.$refs.comA; | |
14 | console.log(comA.name); // Vue.js | |
15 | comA.sayHello(); // hello | |
16 | } | |
17 | } | |
18 | </script> |