index.tsx 931 B

12345678910111213141516171819202122232425262728293031
  1. import IconCloseWhite from "@/images/icon-close-white.svg";
  2. import { Image, View } from "@tarojs/components";
  3. import Taro from "@tarojs/taro";
  4. import { useState } from "react";
  5. import styles from "./index.module.less";
  6. interface CompProps {}
  7. const Comp: React.FC<CompProps> = () => {
  8. const [hidden, setHidden] = useState(false);
  9. const handleCloseAction = () => {
  10. setHidden(true)
  11. };
  12. const handleCreateAction = () => {
  13. Taro.switchTab({
  14. url: "/pages/index/index",
  15. });
  16. }
  17. return hidden ? (
  18. <></>
  19. ) : (
  20. <View className={styles.container}>
  21. <View className={styles.closeBox} onClick={handleCloseAction}>
  22. <Image src={IconCloseWhite} className={styles.icon}></Image>
  23. </View>
  24. <View className={styles.text}>🥳 搭一个自己的智能主页吧~</View>
  25. <View className={styles.btn} onClick={handleCreateAction}>前往</View>
  26. </View>
  27. );
  28. };
  29. export default Comp;