APP.vue
<template>
<div id="app">
<componentsA v-bind:number=123456></componentsA>
</template>
<script>
import componentsA from './components/A.vue'/* 在需要引入的根组件内部也要声明import*/
export default {
components:{
'componentsA':componentsA},/* 申明components属性 */
data:function(){
return.....
}
watch:{
.....}
<script>
<title>
....
<title>
A.vue
<template>
<div>
my number is a {{number}}
</div>
</template>
<script>
export default {
props:['number'],
data:function(){
return {
hello:'i am A vue'
}
}
}
</script>
<style>
</style>
main.js
import componentsA from './components/A.vue'//所有新建的组件 都必须在这里注册