为了账号安全,请及时绑定邮箱和手机立即绑定

vue的button怎么调用函数

vue的button怎么调用函数

红糖糍粑 2019-02-20 14:13:42
vue的button怎么调用函数
查看完整描述

1 回答

?
元芳怎么了

TA贡献1798条经验 获得超7个赞

port {getReferPage} from '../../vuex/getters.js'
export default {
vuex: {
getters: {
referPage: getReferPage,
loginName: state => state.loginName // 用户名。同时用来判断是否已经登录
},
actions: {
logout: ({dispatch}) => {
dispatch('SIGN_OUT')
}
}
},
methods: {
// 这里!希望被调用的函数,当用户登录后loginName会改变,希望跳转到其他页面
goIndex () {
if (this.loginName) {
if (this.referPage === window.location.href) {
this.$route.router.go('index')
} else {
window.history.go(-1)
}
}
}
}



查看完整回答
反对 回复 2019-03-02
  • 1 回答
  • 0 关注
  • 1335 浏览

添加回答

举报

0/150
提交
取消
意见反馈 帮助中心 APP下载
官方微信