import { computed } from 'vue' import { useStore } from 'vuex' export default () => { return cb => { const store = useStore() const token = computed(() => store.state.token) if (token.value) { cb && cb() } else{ uni.showModal({ content: '你还未登录,请先登录', confirmText: '去登录', confirmColor: '#0063F5', success: function (res) { if (res.confirm) { uni.navigateTo({ url: '/modules/common/login/login' }) } } }) } } }