写一个公用的组件 这样在其它页面也可以直接复用
组件m-header.vue
在其他页面中引入组件并使用 index.vue
<template>
<div>
<top title="首页表题" class="top">
<div slot="right">
右边
</div>
</top>
<div style="height:500px;" @click="toPh">点击</div>
</div>
</template>
<script>
import top from ‘@/components/m-header.vue‘
export default {
components: {
top
},
name: ‘index‘,
data() {
return {
};
},
created() {
// if(this.$client.WEBKIT) {
// console.log(‘谷歌首页‘)
// }
},
methods:{
toPh() {
this.$router.push({
name: ‘father‘
})
},
}
};
</script>
效果显示:

在其他页面使用只需改页面标题 title文字即可。
原文:https://www.cnblogs.com/toughy/p/13157134.html