component.tsx 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. import { css } from "@linaria/core";
  2. import { isPc } from "@queenjs/utils";
  3. import { onMounted, ref } from "vue";
  4. import { string } from "vue-types";
  5. import { useCompData } from ".";
  6. import { Text } from "../../..";
  7. import { createUIComp } from "../../../defines/createUIComp";
  8. export const Component = createUIComp({
  9. props: {
  10. compId: string().isRequired,
  11. },
  12. setup(props) {
  13. const { children } = useCompData(props.compId);
  14. const elRef = ref();
  15. onMounted(() => {
  16. elRef.value.style.height = isPc()
  17. ? "12.8rem"
  18. : document.documentElement.clientHeight + "px";
  19. });
  20. return () => {
  21. return (
  22. <div class={compStyle} ref={elRef}>
  23. <Text.Component compId={children.title.id} />
  24. <div class="arrow">↓</div>
  25. </div>
  26. );
  27. };
  28. },
  29. });
  30. const compStyle = css`
  31. .arrow {
  32. position: absolute;
  33. left: 50%;
  34. bottom: 0.42rem;
  35. width: 0.7rem;
  36. height: 0.7rem;
  37. line-height: 0.7rem;
  38. font-size: 0.36rem;
  39. text-align: center;
  40. color: #fff;
  41. border: 2px solid #fff;
  42. border-radius: 50%;
  43. transform: translateX(-50%);
  44. }
  45. `;