<template>
  <div
    class="home-card"
    :style="{ left: left / 80 + 'rem', top: top / 80 + 'rem' }"
    @click="handleClick"
  >
    <div class="home-card__tag">
      <span>{{ name }}</span>
    </div>
  </div>
</template>

<script lang="ts" setup>
import { toRefs } from "vue";
import "./index.scss";
import { useRouter } from "vue-router";

const props = defineProps<{
  id: number;
  name: string;
  left: number;
  top: number;
}>();
const { name, left, top, id } = toRefs(props);
const router = useRouter();

const handleClick = () => {
  router.push({
    name: "cloudMuseum",
    params: {
      id: id.value,
    },
  });
};
</script>
