1. 程式人生 > >vue2.0初始化一個頭部元件

vue2.0初始化一個頭部元件

這裡使用cli腳手架構建工具構建的專案,開啟專案直接修改一下APP.vue,在新建一個目錄和檔案放組建的內容就可以完成組建的註冊程式碼:

APP . VUEDE 程式碼

<template>
  <div id="app">
    <myheader></myheader>
    <div class="tab">我是商品</div>
    <div class="footer">我是商家</div>
  </div>
</template>


<script>
import header from './components/header/header.vue'

export default {
  name: 'app',
  components:{
  myheader: header
  }
}
</script>


<style>


</style>

組建的程式碼

<template>
<div>我是元件頭部</div>
</template>


<script>
export default{

}
</script>


<style>
</style>

需要注意的是注意下路徑