父组件传值给子组件

app.vue


<template>
  <div id="main">
    <router-view
        :test_value="this.test_value"
        ></router-view>
  </div>
</template>
 

export default { name: 'App', components: {test}, // props: ['test_value'], data() { return { test_value: '1234567', } }, }

子组件 test.vue

<template>
    <div>{{test_value}}</div>
</template>>

<script>

export default {
    props: ['getData', 'test_value'],
    name: 'test',


}
</script>

 

posted @ 2023-08-05 17:57  半日闲1  阅读(4)  评论(0编辑  收藏  举报