123456789101112131415161718192021222324252627282930313233343536 |
- <template>
- <div class="app">
- 哈哈哈
- <h2 ref="ab" @click="getMain">明天夏至</h2>
- <!-- 3.使用组件 -->
- <partFirst />
- <Demo2></Demo2>
- <Demo1></Demo1>
- </div>
- </template>
- <script>
- // 1.引入组件
- import partFirst from "./components/partFirst.vue";
- import Demo1 from "./components/Demo1.vue";
- import Demo2 from "./components/Demo2.vue";
- export default {
- // 2.注册组件
- components: {
- partFirst,
- Demo1,
- Demo2
- },
- created() {
- let aa = this.$refs
- console.log(aa.ab);
- },
- methods:{
- getMain() {
- console.log(this.$refs.ab);
- }
- }
- };
- </script>
- <style></style>
|