1 ```
2 方法一:
3 子组件:
4 methods: {
5 menubtn(index) {
6 this.num=index
7 // 子传父 调试父组件方法 parent
8 //把index传过去了
9 this.$parent.fatherMethod(index)
10
11 }
12 },
13 父组件:
14 methods: {
15 // 被子组件tabs调用的方法
16 fatherMethod(index) {
17 this.hideing = index;
18 },
19 }
20
21
22
23 方法二:
24 子组件
25 methods: {
26 menubtn(index) {
27 this.num=index
28 //把index传给了dadMethod(括号里面的形参)
29 this.$emit('dadMethod',index)
30
31
32 }
33 },
34
35
36 父组件
<Tabs @dadMethod="dadMethod" ></Tabs>
37 dadMethod(e) {
38 this.hideing = e;
39 },
40 ```