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