VUE项目中 返回按钮 的处理, 各个分页有返回按钮,首页没有。
主要代码:
<mt-header fixed title="黑马程序员·Vue项目">
<span slot="left" @click="goBack" v-show="flag">
<mt-button icon="back">返回</mt-button>
</span>
</mt-header>
data() {
return {
flag: flase // 默认不显示返回按钮
};
},
methods: {
goBack() {
// 点击返回按钮,向后跳转
this.$router.go(-1)