inleft
2022-01-19 b4f6a53cc4815471c6b936cd462bb4500883a2f6
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>