一、父组件向子组件传递数据(props) 

<template>
    <view class="container" style="background: #0062CC;">
         
        <view class="child"> hi {{showModal}}</view> 
    </view>
</template>


<script>
    export default {
        props: {
            showModal: {
                type: String,
                default: 'hello'
            }
        },

        data() {
            return {
                   
            }; 
        },methods:{ 
            
        }
    }
</script>

<style>

</style>
child

相关文章: