inleft
2022-02-10 279785b0686f3de1763056286a80360cdf5264f2
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
// 子组件中
<template>
    <div class="com_a">
        <span>{{messageA}}</span>
        <p>获取父组件的值为: {{parentVal}}</p>
    </div>
</template>
 
<script>
    export default {
        data() {
            return {
                messageA: 'this is old'
            }
        },
        computed: {
            parentVal() {
                return this.$parent.msg;
            }
        }
    }
</script>