所有的頁面放在 src -> components 中
路徑寫在 src -> router -> index.js 中
(如果后面用到ajax的話 ,要這個js中添加import Resource from 'vue-resource' Vue.use(Resource))
app.vue
整個項目中 每個頁面都有的組件 可以直接寫在這里
(類似 導航條)
父組件傳值給 子組件
父組件中
<childer :val="count"></childer>
子組件 接受 父組件給的值
子組件 中
props: {
val: {
type: Boolean,
default: false
}
}
子組件 觸發(fā) 父組件的事件
子組件中
something ( ) {
........
this.$emit('select', value)
}
父組件 接受 子組件的事件觸發(fā)
父組件中
<childer :select="doSome"></childer>
methods: {
doSome ( value ) {
....
}
}