feat: initial commit with Taro + React project

This commit is contained in:
Mikuisnotavailable
2026-03-30 14:33:33 +08:00
commit 96cfc609b2
21 changed files with 16036 additions and 0 deletions

BIN
src/pages/index/hook.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.9 KiB

View File

@@ -0,0 +1,4 @@
export default {
navigationBarTitleText: 'Taro-hooks',
enableShareAppMessage: true,
};

56
src/pages/index/index.css Normal file
View File

@@ -0,0 +1,56 @@
page {
background-color: white;
padding : 14px;
box-sizing : border-box;
color : #333;
}
.wrapper {
display : flex;
flex-direction: column;
}
.logo {
display: block;
width : 270px;
height : 270px;
margin : 0 auto;
}
.title,
.desc {
text-align: center;
font-size : 32px;
}
.desc {
margin : 20px 0;
font-size: 28px;
color : rgba(0, 0, 0, .85);
}
.list {
padding : 24px 0;
font-size : 32px;
display : flex;
align-items : center;
border-color: rgba(51, 51, 51, .1);
border-style: solid;
border-width: 1px 0 1px 0;
}
.list:not(:first-child) {
border-top-width: 0;
}
.label {
flex: 0.4;
}
.button {
display : block;
width : 100%;
background-color: transparent;
border-radius : 2px;
margin-top : 20px;
}

47
src/pages/index/index.tsx Normal file
View File

@@ -0,0 +1,47 @@
import React, { useCallback } from "react";
import { View, Text, Button, Image } from "@tarojs/components";
import { useEnv, useNavigationBar, useModal, useToast } from "taro-hooks";
import logo from "./hook.png";
import './index.css'
const Index = () => {
const env = useEnv();
const { setTitle } = useNavigationBar({ title: "Taro Hooks" });
const showModal = useModal({
title: "Taro Hooks Canary!",
showCancel: false,
confirmColor: "#8c2de9",
confirmText: "支持一下"
});
const { show } = useToast({ mask: true });
const handleModal = useCallback(() => {
showModal({ content: "不如给一个star⭐!" }).then(() => {
show({ title: "点击了支持!" });
});
}, [show, showModal]);
return (
<View className="wrapper">
<Image className="logo" src={logo} />
<Text className="title">Taro而设计的Hooks Library</Text>
<Text className="desc">
70%API. API在H5端短板. 40+Hooks!
ahook适配Taro! 更多信息可以查看新版文档: https://next-version-taro-hooks.vercel.app/
</Text>
<View className="list">
<Text className="label"></Text>
<Text className="note">{env}</Text>
</View>
<Button className="button" onClick={() => setTitle("Taro Hooks Nice!")}>
</Button>
<Button className="button" onClick={handleModal}>
使Modal
</Button>
</View>
);
};
export default Index;