最近做一个vue的项目首页要求不显示Footer的组件,其余的详情页需要显示。特此做了如下的处理
参考网址:https://www.cnblogs.com/zdz8207/p/vue-header-footer-emit.html
在app.vue文件里引入公共的footer并且footer 默认显示,例如某个页面不需要显示footer
可以使用 this.$emit('footer',false); 来控制footer不显示
例如:test页面不需要显示footer,在页面被创建的时候广播(this.$emit)告诉上级不显示footer
代码:
app.vue
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 |
|