vue使用笔记

1,vue2.0+webpack如何注册组件?

全局注册:mt-content

import Vue from 'vue'
import mtContent from './component/mt-content.vue'
import App from './App.vue'
Vue.component('mt-content', mtContent)
new Vue({
  el: '#app',
  render: h => h(App)
})

局部注册:mt-content

<template>
  <div id="app">
    <mt-content>

    </mt-content>
  </div>
</template>
<script>
  import mtContent from './view/mtContent.vue'
  export default {
    name:'app',
    components: {
      mtContent: mtContent,
    },
    data: function () {
      return {
  
      }
    },
    computed: {
      title: function () {
   
      }
    },
    methods: {

    }
  }
</script>
posted @ 2016-12-05 13:55  minimal虾米  阅读(101)  评论(0编辑  收藏  举报