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

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

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

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

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