vue组件内数据变化,怎样触发/调用函数

vue组件内数据变化,怎样触发/调用函数


潇潇雨雨
浏览 2466回答 1
1回答

呼如林

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)}}}}
打开App,查看更多内容
随时随地看视频慕课网APP