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

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

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

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

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