vue的button怎么調(diào)用函數(shù)
1 回答

元芳怎么了
TA貢獻1798條經(jīng)驗 獲得超7個贊
port {getReferPage} from '../../vuex/getters.js'
export default {
vuex: {
getters: {
referPage: getReferPage,
loginName: state => state.loginName // 用戶名。同時用來判斷是否已經(jīng)登錄
},
actions: {
logout: ({dispatch}) => {
dispatch('SIGN_OUT')
}
}
},
methods: {
// 這里!希望被調(diào)用的函數(shù),當(dāng)用戶登錄后loginName會改變,希望跳轉(zhuǎn)到其他頁面
goIndex () {
if (this.loginName) {
if (this.referPage === window.location.href) {
this.$route.router.go('index')
} else {
window.history.go(-1)
}
}
}
}
- 1 回答
- 0 關(guān)注
- 1405 瀏覽
添加回答
舉報
0/150
提交
取消