inleft
2022-08-30 271ca6cb0ee2ff0a789bf74d1821e7891a7043bb
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>