[Vue] Import component into page

Components are one of the most powerful features of Vue. Let's take a look at how to write our first components and make use of them in a parent component.

 

Create a component: 

// item-description.vue

<template>
    <h1>
        This is item description
    </h1>
</template>

<script>
export default {
name: 'item-description'
}
</script>

 

Page:

<template>

    <section class="container">
        <item-description></item-description>
    </section>
</template>

<script> import ItemDescription from '../components/item-description'; export default { components: { ItemDescription } } </script>

 

posted @ 2017-01-20 19:05  Zhentiw  阅读(511)  评论(0编辑  收藏  举报