<template>
  <slot v-if="isLogged" />
  <view v-else class="d-flex flex-column align-center justify-center height-300">
    <text>{{unLoginMessage}}</text>
    <Button type="primary" text="去登录" @click="goLogin" />
  </view>
</template>

<script setup lang="ts">
import { useAuthStore } from '@/store/auth';
import { navTo } from '@/components/utils/PageAction';
import { computed } from 'vue';
import Button from '@/components/basic/Button.vue';

const authStore = useAuthStore();
const isLogged = computed(() => authStore.isLogged);

defineProps({	
  unLoginMessage : {
    type: String,
    default: '登录后享受更多权益'
  },
})

function goLogin() {
  navTo('/pages/user/login');
}
</script>