Vue 組件引入 九

<template>
    <div>
        <!-- 3.在template中就能夠直接使用了 -->
        <testComponent></testComponent>
    </div>
</template>
 
<script>
    //1.先使用import導入你要在該組件中使用的子組件
    import testComponent from './testComponent.vue'
    export default {
        //2.而後,在components中寫入子組件
        components: {testComponent},
        methods: {},
    }
</script>
 
<style></style>

儘量的拆分代碼javascript

相關文章
相關標籤/搜索