--- url: https://taroify.com/introduce/index.md --- # 介绍 ![logo](https://img.yzcdn.cn/vant/logo.png) **轻量、可靠、面向多端的 Taro React UI 组件库 ** 基于 Vant 设计语言,为小程序与 H5 提供一致、类型安全且高度可定制的开发体验。 [**官网 **](https://taroify.com/) · [**快速上手 **](https://taroify.com/quickstart/) · [**在线演示 **](https://taroify.com/h5/index.html) · [**CLI / MCP **](https://taroify.com/cli/) · [**讨论区 **](https://github.com/taroify/taroify/discussions) ## Taroify 是什么 Taroify 是移动端组件库 [Vant](https://github.com/youzan/vant) 的 Taro React 版本,两者基于相同的视觉规范,提供近似一致的 API 接口,助力开发者快速搭建小程序应用。 ## ✨ 特性 - 🚀 性能极佳,组件平均体积小于 1KB(min+gzip) - 💎 70+ 个高质量组件,覆盖移动端主流场景 - 💪 使用 TypeScript 编写,提供完整的类型定义 - 💪 单元测试覆盖率超过 90%,提供稳定性保障 - 📖 提供完善的中文文档和组件示例 - 🍭 支持 React - 🍭 支持主题定制,内置 700+ 个主题变量 - 🍭 支持按需引入和 Tree Shaking ## 浏览器支持 支持现代浏览器以及 Chrome >= 51、iOS >= 10.0。 ## 安装 在现有项目中使用 Taroify 时,可以通过 `npm` 进行安装 ## 快速开始 ### 安装 ```sh [npm] npm install @taroify/core ``` ```sh [yarn] yarn add @taroify/core ``` ```sh [pnpm] pnpm add @taroify/core ``` ### 使用组件 ```tsx import { Button } from "@taroify/core" import "@taroify/core/button/style" export default function Index() { return } ``` 推荐配置自动按需引入,以获得更简洁的源码和更小的构建产物。完整配置请查看 [快速上手](https://taroify.com/quickstart/)。 ## Packages Taroify 采用 Monorepo 组织,各能力可以独立安装和组合: | Package | 说明 | | :--------------------------------------------------------------------- | :--------------------------- | | [`@taroify/core`](https://www.npmjs.com/package/@taroify/core) | 核心 UI 组件与主题系统 | | [`@taroify/icons`](https://www.npmjs.com/package/@taroify/icons) | Taro React 图标组件 | | [`@taroify/hooks`](https://www.npmjs.com/package/@taroify/hooks) | 面向组件与业务场景的 React Hooks | | [`@taroify/commerce`](https://www.npmjs.com/package/@taroify/commerce) | 电商场景扩展组件 | | [`@taroify/cli`](https://www.npmjs.com/package/@taroify/cli) | 离线组件知识 CLI、MCP 与 Agent Skill | | [`@taroify/mcp`](https://www.npmjs.com/package/@taroify/mcp) | 现有独立 MCP 服务 | ## 本地开发 ```bash # 克隆仓库 git clone https://github.com/taroify/taroify.git cd taroify # 安装根目录、工作区和官网依赖 pnpm run install:node_modules # 启动 H5 组件示例与文档站点 pnpm develop ``` 更多仓库结构、组件开发与提交规范,请阅读 [贡献指南](https://taroify.com/contribution/)。 ## 社区 如果你发现问题、希望增加组件,或对 API 设计有建议,欢迎通过以下方式参与: - [提交 Issue](https://github.com/mataroifyllfoundry/taroify/issues) - [发起 Pull Request](https://github.com/taroify/taroify/pulls) - [参与 Discussions](https://github.com/taroify/taroify/discussions) - [查看更新日志](https://taroify.com/changelog/) **加入微信交流群 ** ![Taroify 微信交流群](/introduce/wechat-qrcode.jpg) 添加好友时请备注「taroify」,通过后邀请进群。 ## 贡献者 感谢每一位为 Taroify 提交代码、文档、设计、Issue 与建议的贡献者。 [![contributors](https://contrib.rocks/image?repo=taroify/taroify)](https://github.com/taroify/taroify/graphs/contributors) 部分图形设计来自 [@BiscuitCoder](https://uyyu.xyz/)。 ## 生态与致谢 Taroify 的设计规范与大量组件经验来自 Vant。感谢 [Vant 团队](https://github.com/youzan/vant) 多年来对移动端组件生态的持续投入,也感谢 [JetBrains](https://www.jetbrains.com/) 为开源项目提供开发工具支持。 **Vant 官方生态 ** | 项目 | 描述 | | :------------------------------------------------------------------------------------------ | :----------- | | [Vant](https://github.com/youzan/vant) | Vant Vue 版 | | [Vant Weapp](https://github.com/youzan/vant-weapp) | Vant 微信小程序版 | | [Vant Demo](https://github.com/youzan/vant-demo) | Vant 官方示例合集 | | [Vant CLI](https://github.com/youzan/vant/tree/dev/packages/vant-cli) | 开箱即用的组件库搭建工具 | | [Vant Icons](https://github.com/youzan/vant/tree/dev/packages/vant-icons) | Vant 图标库 | | [Vant Touch Emulator](https://github.com/youzan/vant/tree/dev/packages/vant-touch-emulator) | 桌面端触摸事件模拟工具 | **社区生态与友情推荐 ** | 项目 | 描述 | | :------------------------------------------------------------------- | :----------------------- | | [React Vant](https://github.com/3lang3/react-vant) | 参照 Vant 打造的 React 移动端组件库 | | [mockm](https://github.com/wll8/mockm) | 面向前端开发的接口模拟工具 | | [taro-hooks](https://github.com/innocces/taro-hooks) | 为 Taro 设计的 Hooks Library | | [tarojs-router-next](https://github.com/lblblong/tarojs-router-next) | 提供类型提示与参数能力的 Taro 路由库 | ### 支持者 感谢 [@Yorksh1re](https://github.com/Yorksh1re)、 [@akazwz](https://github.com/akazwz)、 [@Yang](https://github.com/programmer-yang)、 [@coderYarn](https://github.com/coderYarn)、 [@蔡包](https://github.com/shaolongcai)、 [@王昆](https://github.com/lifeneedspassion) 以及所有支持 Taroify 的开发者。 ## License [MIT](https://github.com/taroify/taroify/blob/main/LICENSE) © Taroify Contributors --- url: https://taroify.com/quickstart/index.md --- # 快速上手 ### 介绍 通过本章节你可以了解到 Taroify 的安装方法和基本使用姿势。 ### 安装 ```sh [npm] npm install @taroify/core ``` ```sh [yarn] yarn add @taroify/core ``` ```sh [pnpm] pnpm add @taroify/core ``` ## 引入组件 ### 方式一. 自动按需引入组件 (推荐) [babel-plugin-import](https://github.com/ant-design/babel-plugin-import) 是一款 babel 插件,它会在编译过程中将 import 的写法自动转换为按需引入的方式。 ```sh [npm] npm install babel-plugin-import -D ``` ```sh [yarn] yarn add babel-plugin-import -D ``` ```sh [pnpm] pnpm add babel-plugin-import -D ``` 加载Sass源文件,通过Taro转成CSS ```js title="babel.config.js" lineNumbers module.exports = { plugins: [ [ "import", { libraryName: "@taroify/core", libraryDirectory: "", style: true, }, "@taroify/core", ], [ "import", { libraryName: "@taroify/icons", libraryDirectory: "", camel2DashComponentName: false, style: () => "@taroify/icons/style", customName: (name) => name === "Icon" ? "@taroify/icons/van/VanIcon" : `@taroify/icons/${name}`, }, "@taroify/icons", ], ], }; ``` 若不想加载Sass源文件或者其他情况,也可以加载编译后的CSS文件 ```js title="babel.config.js" lineNumbers module.exports = { plugins: [ [ "import", { libraryName: "@taroify/core", libraryDirectory: "", style: (name) => `${name}/index.css`, }, "@taroify/core", ], [ "import", { libraryName: "@taroify/icons", libraryDirectory: "", camel2DashComponentName: false, style: () => "@taroify/icons/index.css", customName: (name) => name === "Icon" ? "@taroify/icons/van/VanIcon" : `@taroify/icons/${name}`, }, "@taroify/icons", ], ], }; ``` Vite 版本 ```sh [npm] npm install vite-plugin-style-import consola -D ``` ```sh [yarn] yarn add vite-plugin-style-import consola -D ``` ```sh [pnpm] pnpm add vite-plugin-style-import consola -D ``` ```ts title="config/index.ts" lineNumbers import { createStyleImportPlugin } from "vite-plugin-style-import"; export default defineConfig<"vite">(async (merge, { command, mode }) => { const baseConfig: UserConfigExport<"vite"> = { compiler: { type: "vite", vitePlugins: [ createStyleImportPlugin({ libs: [ { libraryName: "@taroify/core", esModule: true, resolveStyle: (name: string) => `@taroify/core/${name}/style/index.js`, ensureStyleFile: true, }, { libraryName: "@taroify/icons", esModule: true, resolveStyle: () => "@taroify/icons/style", }, ], }), ], }, } process.env.BROWSERSLIST_ENV = process.env.NODE_ENV; if (process.env.NODE_ENV === "development") { // 本地开发构建配置(不混淆压缩) return merge({}, baseConfig, devConfig); } // 生产构建配置(默认开启压缩混淆等) return merge({}, baseConfig, prodConfig); }) ``` 接着你可以在代码中直接引入 Taroify 组件: ```tsx // 插件会自动将代码转化为方式二中的按需引入形式 import { Button } from "@taroify/core" ``` ### 方式二. 手动按需引入组件 在不使用插件的情况下,可以手动引入需要的组件。 ```tsx import "@taroify/core/button/style" import { Button } from "@taroify/core" // css import "@taroify/core/button/index.css" import { Button } from "@taroify/core" ``` ### 在使用上面两种CSS方式引入时,若要使用[Style 内置样式](/components/style.md), 需要单独引入(版本 > 0.8.1 才产出次文件,之前未产出,低版本无法通过CSS方式引入) ```tsx import "@taroify/core/styles/index.css" ``` ### 方式三. 导入所有组件样式 Taroify 支持一次性导入所有组件,引入所有组件会增加代码包体积,因此不推荐这种做法。 ```tsx title="app.ts" import "@taroify/icons/index.scss" import "@taroify/core/index.scss" // css import "@taroify/icons/index.css" import "@taroify/core/index.css" ``` > Tips: 配置按需引入后,将不允许直接导入所有组件。 ## 适配 ### Rem 布局适配 Taroify 默认采用 `rem` 单位,需要对 `@taroify` 里的样式单位进行转换适配。 ```js title="config/index.js" lineNumbers const config = { h5: { esnextModules: ["@taroify"], } } ``` ### designWidth Taroify designWidth 为 750。如果你的 `designWidth` 为 375,显示效果会放大两倍。由于 Taroify 内部样式已经改为 Sass Modules(`@use`),旧的 `sass.data: "$hd: 1;"` 写法已经不会生效,需要改为在构建时配置 `variables` 模块: ```js title="config/index.js" lineNumbers module.exports = { // ... sass: { data: '@use "@taroify/core/styles/variables" as taroify_variables with ($hd: 1);' } } ``` 同时需要确保引入的是 scss 入口: ```tsx import "@taroify/core/index.scss" import "@taroify/icons/index.scss" ``` 如果引入的是 `@taroify/core/index.css` 或 `@taroify/icons/index.css`,Sass 变量覆盖不会生效。 --- url: https://taroify.com/contribution/index.md --- # 开发指南 ### 介绍 感谢你使用 Taroify。 以下是关于向 Taroify 提交反馈或代码的指南。在向 Taroify 提交 issue 或者 PR 之前,请先花几分钟时间阅读以下文字。 ### Issue 规范 - 遇到问题时,请先确认这个问题是否已经在 issue 中有记录或者已被修复 - 提 issue 时,请用简短的语言描述遇到的问题,并添加出现问题时的环境和复现步骤 ## 参与开发 ### 本地开发 按照下面的步骤操作,即可在本地开发 Taroify 组件。 ```bash # 全局安装 rimraf npm install -g rimraf # 克隆仓库 # 默认为 main 分支,包含 Taroify 的代码 git clone https://github.com/taroify/taroify.git # 安装依赖 cd taroify && pnpm run install:node_modules # 进入开发模式,浏览器访问 http://localhost:8000 pnpm run develop ``` ### 目录结构 - 仓库的组件代码位于 packages/core 下,每个组件一个文件夹 - site 目录下是文档网站的代码,本地开发时可以运行 pnpm --dir site run site:develop 开启文档网站 项目主要目录如下: ```text taroify ├─ bundles # 构建 ├─ packages/core # 组件 ├─ packages # 子包 ├─ site # 文档 └─ scripts # 脚本 ``` ### 添加新组件 添加新组件时,请按照下面的目录结构组织文件。 ```text src └─ button ├─ __tests__ # 单元测试 ├─ variables.scss # 组件样式变量 ├─ button.tsx # 具名组件 ├─ button.scss # 组件样式 ├─ index.ts # 组件入口 ├─ index.scss # 组件样式入口 ``` ## 提交 PR ### Pull Request 规范 - 如果遇到问题,建议保持你的 PR 足够小。保证一个 PR 只解决一个问题或只添加一个功能 - 当新增组件或者修改原有组件时,记得增加或者修改测试代码,保证代码的稳定 - 在 PR 中请添加合适的描述,并关联相关的 Issue ### Pull Request 流程 1. fork 主仓库,如果已经 fork 过,请同步主仓库的最新代码 2. 基于 fork 后仓库的 main 分支新建一个分支,比如`feature/button-color` 3. 在新分支上进行开发,开发完成后,提 Pull Request 到主仓库的 dev 分支 4. Pull Request 会在 Review 通过后被合并到主仓库 5. 等待 Taroify 发布版本,一般是每周一次 ### 同步最新代码 提 Pull Request 前,请依照下面的流程同步主仓库的最新代码: ```bash # 添加主仓库到 remote,作为 fork 后仓库的上游仓库 git remote add upstream https://github.com/taroify/taroify.git # 拉取主仓库最新代码 git fetch upstream # 切换至 dev 分支 git checkout main # 合并主仓库代码 git merge upstream/main ``` --- url: https://taroify.com/changelog/index.md --- # 更新日志 ### 介绍 Taroify 遵循 [Semver](https://semver.org/lang/zh-CN/) 语义化版本规范。 **发布节奏** - 修订号:每周发布,包含新特性和问题修复。 - 次版本号:每隔一至二个月发布,包含新特性和较大的功能更新,向下兼容。 - 主版本号:发布时间不定,包含不兼容更新。 ## 更新内容 ### v1.0.2 `2026-07-27` #### What's Changed ##### New Features 🎉 - feat(image): 🎸 增强图片组件能力 by [@Pilotager](https://github.com/Pilotager) in [#1052](https://github.com/taroify/taroify/pull/1052) - feat(icon): 新增图标并支持图片图标 by [@Pilotager](https://github.com/Pilotager) in [#1049](https://github.com/taroify/taroify/pull/1049) - feat(flex): 🎸 增强布局间距并完善工程校验 by [@Pilotager](https://github.com/Pilotager) in [#1057](https://github.com/taroify/taroify/pull/1057) - feat(popup): 🎸 增强弹出层并完善文档展示 by [@Pilotager](https://github.com/Pilotager) in [#1060](https://github.com/taroify/taroify/pull/1060) ##### Bug Fixes 🐞 - fix: 🐛 修复小程序样式并完善组件测试 by [@Pilotager](https://github.com/Pilotager) in [#1077](https://github.com/taroify/taroify/pull/1077) ##### Other Changes - chore(deps): update actions/setup-node action to v7 by [@renovate\[bot\]](https://github.com/apps/renovate) in [#1045](https://github.com/taroify/taroify/pull/1045) - chore(deps): update actions/checkout action to v7 by [@renovate\[bot\]](https://github.com/apps/renovate) in [#1044](https://github.com/taroify/taroify/pull/1044) - chore(deps): update dependency lefthook to v2 by [@renovate\[bot\]](https://github.com/apps/renovate) in [#1066](https://github.com/taroify/taroify/pull/1066) - chore(deps): update dependency jest-transform-css to v6 by [@renovate\[bot\]](https://github.com/apps/renovate) in [#1065](https://github.com/taroify/taroify/pull/1065) - chore(deps): 升级 Lerna 并清理无用资源 by [@Pilotager](https://github.com/Pilotager) in [#1071](https://github.com/taroify/taroify/pull/1071) - chore(deps): update github artifact actions (major) by [@renovate\[bot\]](https://github.com/apps/renovate) in [#1076](https://github.com/taroify/taroify/pull/1076) - chore(deps): update actions/github-script digest to 3a2844b by [@renovate\[bot\]](https://github.com/apps/renovate) in [#1075](https://github.com/taroify/taroify/pull/1075) - chore: 🤖 Release 1.0.2 by [@Pilotager](https://github.com/Pilotager) in [#1078](https://github.com/taroify/taroify/pull/1078) **Full Changelog**: [https://github.com/taroify/taroify/compare/v1.0.1...v1.0.2](https://github.com/taroify/taroify/compare/v1.0.1...v1.0.2) ### v1.0.1 `2026-07-25` #### What's Changed ##### New Features 🎉 - feat(button): 完善按钮自定义、加载和无障碍能力 by [@Pilotager](https://github.com/Pilotager) in [#1032](https://github.com/taroify/taroify/pull/1032) - feat(site): 自动同步 GitHub Release 变更日志 by [@Pilotager](https://github.com/Pilotager) in [#1028](https://github.com/taroify/taroify/pull/1028) - feat(cell): 升级单元格组件 by [@Pilotager](https://github.com/Pilotager) in [#1036](https://github.com/taroify/taroify/pull/1036) - feat: 新增 Taroify CLI 与 MCP 支持 by [@Pilotager](https://github.com/Pilotager) in [#1043](https://github.com/taroify/taroify/pull/1043) - feat: 🎸 Release 1.0.1 by [@Pilotager](https://github.com/Pilotager) in [#1046](https://github.com/taroify/taroify/pull/1046) ##### Bug Fixes 🐞 - fix: 🐛 Radio 和 Checkbox 的背景色和边框区分度不够明显 by [@Pilotager](https://github.com/Pilotager) in [#1025](https://github.com/taroify/taroify/pull/1025) ##### Document 📖 - docs(site): 完善文档展示与版本标记 by [@Pilotager](https://github.com/Pilotager) in [#1023](https://github.com/taroify/taroify/pull/1023) ##### Other Changes - test(core): 补全组件测试 by [@Pilotager](https://github.com/Pilotager) in [#1022](https://github.com/taroify/taroify/pull/1022) - docs: ✏️ 更改地址 by [@Pilotager](https://github.com/Pilotager) in [#1026](https://github.com/taroify/taroify/pull/1026) - chore(deps): update jamesives/github-pages-deploy-action action to v4.8.0 by [@renovate\[bot\]](https://github.com/apps/renovate) in [#1038](https://github.com/taroify/taroify/pull/1038) - chore(deps): update actions/checkout action to v7 by [@renovate\[bot\]](https://github.com/apps/renovate) in [#1039](https://github.com/taroify/taroify/pull/1039) - chore(deps): update actions/setup-node action to v7 by [@renovate\[bot\]](https://github.com/apps/renovate) in [#1040](https://github.com/taroify/taroify/pull/1040) #### New Contributors - [@renovate\[bot\]](https://github.com/apps/renovate) made their first contribution in [#1038](https://github.com/taroify/taroify/pull/1038) **Full Changelog**: [https://github.com/taroify/taroify/compare/v1.0.0...v1.0.1](https://github.com/taroify/taroify/compare/v1.0.0...v1.0.1) ### v1.0.0 `2026-07-20` **新功能 🎉** - Tour - 新增漫游式引导组件 [83027f7](https://github.com/taroify/taroify/commit/83027f755fedbf1022597081ee6267ad85ed5931) [@Pilotager](https://github.com/Pilotager) - ConfigProvider - 支持暗黑模式 [7d0fcc8](https://github.com/taroify/taroify/commit/7d0fcc8cefc56208ea166cc80d6b5c5ff03d6e50) [@Pilotager](https://github.com/Pilotager) - Checkbox / Radio - 增加 `shape="button"`,支持按钮式选择场景 [#1017](https://github.com/taroify/taroify/pull/1017) [@Pilotager](https://github.com/Pilotager) - SafeArea - 支持自定义安全区背景 [#1016](https://github.com/taroify/taroify/pull/1016) [@Pilotager](https://github.com/Pilotager) - 文档站 - 从 Gatsby 迁移至 Rspress 2,新增定制主题、搜索和组件模拟器 [#1020](https://github.com/taroify/taroify/pull/1020) [@Pilotager](https://github.com/Pilotager) **性能优化 🚀** - Form - Rule 支持布尔类型表单项 [#1015](https://github.com/taroify/taroify/pull/1015) [@felix9ia](https://github.com/felix9ia) **Bug 修复 🐞** - ActionBar - 修复图标按钮 Badge 包装后缺少 React key 的警告 [#1016](https://github.com/taroify/taroify/pull/1016) [@Pilotager](https://github.com/Pilotager) - Input - 修复 `type="number"` 时未过滤非数字字符的问题 [#1016](https://github.com/taroify/taroify/pull/1016) [@Pilotager](https://github.com/Pilotager) - DropdownMenu - 增加 `ellipsis` 配置,支持关闭标题省略 [#1016](https://github.com/taroify/taroify/pull/1016) [@Pilotager](https://github.com/Pilotager) - FloatingPanel / FixedView - 增加 `safeAreaProps`,支持独立配置安全区背景 [#1016](https://github.com/taroify/taroify/pull/1016) [@Pilotager](https://github.com/Pilotager) - List / PullRefresh - 修复固定高度下拉刷新问题 [#1016](https://github.com/taroify/taroify/pull/1016) [@Pilotager](https://github.com/Pilotager) - Transition - 修复微信小程序 `nodeRef` 警告 [#1016](https://github.com/taroify/taroify/pull/1016) [@Pilotager](https://github.com/Pilotager) - Textarea - 修复安卓端 `limit` 字数限制失效问题 [#1016](https://github.com/taroify/taroify/pull/1016) [@Pilotager](https://github.com/Pilotager) - Form - 修复嵌套字段提交结构 [#1018](https://github.com/taroify/taroify/pull/1018) [@Pilotager](https://github.com/Pilotager) **其他变更** - 更新 `vite-plugin-style-import` 配置 [#1011](https://github.com/taroify/taroify/pull/1011) [@xuxucode](https://github.com/xuxucode) **Full Changelog**: [v0.9.2...v1.0.0](https://github.com/taroify/taroify/compare/v0.9.2...v1.0.0) ### v0.9.2 `2026-03-10` **Bug Fixes** - Cell - 修复 `value` 空占位问题 [1006](https://github.com/taroify/taroify/pull/1006) [@Duo-Huang](https://github.com/Duo-Huang) - Collapse - 修复在小程序上表现卡顿问题 [1002](https://github.com/taroify/taroify/pull/1002) [@Pilotager](https://github.com/Pilotager) ### v0.9.1 `2026-03-08` **Feature** - Calendar - 支持配置是否显示主标题 [972](https://github.com/taroify/taroify/pull/972) [@qiuxsgit](https://github.com/qiuxsgit) - TabPanel - 将TabPane重命名为TabPanel并更新相关组件和文档 [975](https://github.com/taroify/taroify/pull/975) [@Shixuebin](https://github.com/Shixuebin) - FloatingPanel - 禁用内部 `ScrollView` 的在 IOS 上的 `bounces` 橡皮筋回弹效果 [988](https://github.com/taroify/taroify/pull/988) [@felix9ia](https://github.com/felix9ia) - Cell - 增加 `valueClass` 属性 [994](https://github.com/taroify/taroify/pull/994) [@xuxucode](https://github.com/xuxucode) **Bug Fixes** - PullRefresh - 在 h5 环境下包裹 List 不能正常滚动的问题 [964](https://github.com/taroify/taroify/pull/964) [@felix9ia](https://github.com/felix9ia) - Upload - `Uploader` 自定义预览样式异常,增加 `customUploadButton` 属性 [966](https://github.com/taroify/taroify/pull/966) [@naFeKnehC](https://github.com/naFeKnehC) - 增加 `itemRender` 用来修复使用react children属性时图片重复渲染 [967](https://github.com/taroify/taroify/pull/967) [@naFeKnehC](https://github.com/naFeKnehC) - Cell - 修复 taroify-cell\_\_value 为空的时候依然占位 [968](https://github.com/taroify/taroify/pull/968) [@felix9ia](https://github.com/felix9ia) - FixedView - 修复切换页面高度问题 [996](https://github.com/taroify/taroify/pull/996) [@Pilotager](https://github.com/Pilotager) - Toast - 修复多个 `Toast` 叠加问题 [998](https://github.com/taroify/taroify/pull/998) [@Duo-Huang](https://github.com/Duo-Huang) - Icon - 修复 `color` 属性不生效问题 [999](https://github.com/taroify/taroify/pull/999) [@Pilotager](https://github.com/Pilotager) - Radio - 修复 `1px` 边框问题 [1000](https://github.com/taroify/taroify/pull/1000) [@Pilotager](https://github.com/Pilotager) **Other** - 修正 `List` 搭配 `PullRefresh` 的使用示例 [968](https://github.com/taroify/taroify/pull/968) [@felix9ia](https://github.com/felix9ia) - 更新 `Progress` 示例 [969](https://github.com/taroify/taroify/pull/969) [@lvqq](https://github.com/lvqq) - 修复 `CI` 环境报错 [970](https://github.com/taroify/taroify/pull/970) [@lvqq](https://github.com/lvqq) - 更新 `Dialog` 样式文档 [973](https://github.com/taroify/taroify/pull/973) [@lvqq](https://github.com/lvqq) - 更新 `Cell` 测试快照 [981](https://github.com/taroify/taroify/pull/981) [@Pilotager](https://github.com/Pilotager) - 更新 `Vite` 按需加载示例 [996](https://github.com/taroify/taroify/pull/996) [@Pilotager](https://github.com/Pilotager) - 更新 `$hd` 注入文档 [1001](https://github.com/taroify/taroify/pull/1001) [@Pilotager](https://github.com/Pilotager) ### v0.9.0 `2025-06-15` **Other** - sass 里使用 @use 和 @forward 替换 @import [961](https://github.com/taroify/taroify/pull/961) [@hbztd](https://github.com/hbztd) - 文档添加可以使用编译后的css相关说明 [961](https://github.com/taroify/taroify/pull/961) [@hbztd](https://github.com/hbztd) - Field 文档更新 [960](https://github.com/taroify/taroify/pull/960) [@Zhengxing-Gu](https://github.com/Zhengxing-Gu) ### v0.8.1 `2025-05-25` **Feature** - FloatingPanel - 添加手动设置高度功能 [943](https://github.com/taroify/taroify/pull/944) [@HyaCiovo](https://github.com/HyaCiovo) **Bug Fixes** - Popup - Popup 组件初次挂载时会执行 onClose 事件 [943](https://github.com/taroify/taroify/pull/943) [@HyaCiovo](https://github.com/HyaCiovo) - Transition - 修复 Transition 组件的 findDOMNode API报错问题 [949](https://github.com/taroify/taroify/pull/949) [@HyaCiovo](https://github.com/HyaCiovo) - Checkbox - 在背景中使用正确的变量 [951](https://github.com/taroify/taroify/pull/951) [@lvqq](https://github.com/lvqq) - Dialog - 未传入 title 时仍然渲染 header 的问题 [954](https://github.com/taroify/taroify/pull/954) [@twomoonbird](https://github.com/twomoonbird) - 支持设置 message 的 font-weight [955](https://github.com/taroify/taroify/pull/955) [@twomoonbird](https://github.com/twomoonbird) ### v0.8.0 `2025-04-20` **Feature** - Skeleton - 重构 `Skeleton`,放弃旧版本 `Skeleton` 使用方式 [925](https://github.com/taroify/taroify/pull/925) [@Pilotager](https://github.com/Pilotager) - Cell - 添加 `titleStyle`、`titleClass`、`valueClass`、`briefClass` 属性 [930](https://github.com/taroify/taroify/pull/930) [@Pilotager](https://github.com/Pilotager) **Other** - 文档更新 `MCP` 使用方式 [939](https://github.com/taroify/taroify/pull/939) [@Pilotager](https://github.com/Pilotager) ### v0.7.0 `2025-04-06` **Feature** - Divider - 添加 `type` 属性使分割线垂直展示 [909](https://github.com/taroify/taroify/pull/909) [@Pilotager](https://github.com/Pilotager) - TextEllipsis - 增加 `toggle` 方法 [915](https://github.com/taroify/taroify/pull/915) [@Pilotager](https://github.com/Pilotager) - Toast - 增加 `Toast.allowMultiple()` 方法 [921](https://github.com/taroify/taroify/pull/921) [@Pilotager](https://github.com/Pilotager) - Dialog - 实现多实例 [922](https://github.com/taroify/taroify/pull/922) [@Pilotager](https://github.com/Pilotager) **Bug Fixes** - ActionBar - 优化文字换行 [899](https://github.com/taroify/taroify/pull/899) [@Pilotager](https://github.com/Pilotager) - Toast - 微信小程序Toast或Dialog在特定的回调里报错 [917](https://github.com/taroify/taroify/pull/917) [@Pilotager](https://github.com/Pilotager) **Other** - Biome 格式化 [904](https://github.com/taroify/taroify/pull/904) [@Pilotager](https://github.com/Pilotager) ### v0.6.4-alpha.0 `2025-02-23` **Feature** - List - 新增 `onScroll` 事件 [892](https://github.com/taroify/taroify/pull/892) [@hbztd](https://github.com/hbztd) - Tabs - 新增 `shrink` 属性 [892](https://github.com/taroify/taroify/pull/892) [@hbztd](https://github.com/hbztd) - Field - Input、Textarea 设置 `min-height` 值为 `inherit` [892](https://github.com/taroify/taroify/pull/892) [@hbztd](https://github.com/hbztd) - Switch - 开关组件按有赞美化 [894](https://github.com/taroify/taroify/pull/894) [@wenqiyun](https://github.com/wenqiyun) **Bug Fixes** - SafeArea - 替换成 getWindowInfo 方法 [885](https://github.com/taroify/taroify/pull/885) [@Pilotager](https://github.com/Pilotager) - FixedView - 修复设置 placheholder 后 render 过程中 children 会重建 [892](https://github.com/taroify/taroify/pull/892) [@hbztd](https://github.com/hbztd) - Navbar - 修复设置 placheholder 后 render 过程中 children 会重建 [892](https://github.com/taroify/taroify/pull/892) [@hbztd](https://github.com/hbztd) - Dialog - 消除节点新增删除带来的副作用 [896](https://github.com/taroify/taroify/pull/896) [@wenqiyun](https://github.com/wenqiyun) ### v0.6.3-alpha.0 `2025-01-05` **Bug Fixes** - Picker - 修复 `Picker` 中 `columns` 更新未更新选中值 [875](https://github.com/taroify/taroify/pull/875) [@Pilotager](https://github.com/Pilotager) **Other** - 添加 Biome [872](https://github.com/taroify/taroify/pull/872) [@ianzone](https://github.com/ianzone) - 文档新增新特性版本号 [870](https://github.com/taroify/taroify/pull/870) [@CodeMak1r-zy](https://github.com/CodeMak1r-zy) ### v0.6.2-alpha.0 `2024-12-25` **Bug Fixes** - Toast - 修复 `close` 方法不生效问题 [865](https://github.com/taroify/taroify/pull/865) [@Pilotager](https://github.com/Pilotager) - Notify - 修复 `close` 方法不生效问题 [865](https://github.com/taroify/taroify/pull/865) [@Pilotager](https://github.com/Pilotager) **Other** - 添加属性新特性版本号 [867](https://github.com/taroify/taroify/pull/867) [@Pilotager](https://github.com/Pilotager) ### v0.6.1-alpha.0 `2024-12-18` **Other** - lodash 支持 tree shaking [861](https://github.com/taroify/taroify/pull/861) [@hbztd](https://github.com/hbztd) ### v0.6.0-alpha.0 `2024-12-08` **Feature** - Toast - 支持直接函数调用 [852](https://github.com/taroify/taroify/pull/852) [@hbztd](https://github.com/hbztd) - Notify - 支持直接函数调用,添加 `color` `background` 属性 [852](https://github.com/taroify/taroify/pull/852) [@hbztd](https://github.com/hbztd) - Dialog - 支持直接函数调用,添加 `title` `message` `messageAlign` `theme` `confirm` `cancel` `onBeforeClose` 属性 [852](https://github.com/taroify/taroify/pull/852) [@hbztd](https://github.com/hbztd) **Bug Fixes** - ActionSheet - 为 `ActionSheet` 组件添加默认的安全区域 [840](https://github.com/taroify/taroify/pull/840) [@sweet7788](https://github.com/sweet7788) - List - `scrollParentRect` 判空 [843](https://github.com/taroify/taroify/pull/843) [@Pilotager](https://github.com/Pilotager) - Pick - 修复 picker 组件在快速上滑或者下滑时,执行惯性动画期间,再次滚动 picker-column 后出现的位置卡顿问题 [844](https://github.com/taroify/taroify/pull/844) [@kunkuntang](https://github.com/kunkuntang) - Popup - 修复手动关闭未触发 `onClose` 事件 [852](https://github.com/taroify/taroify/pull/852) [@hbztd](https://github.com/hbztd) - TextArea - 修复 `getStringLength` 在输入 emoji 时无法正确统计字符长度 [853](https://github.com/taroify/taroify/pull/853) [@CodeMak1r-zy](https://github.com/CodeMak1r-zy) - Form - 修复 `validateFirst` [857](https://github.com/taroify/taroify/pull/857) [@linxianxi](https://github.com/linxianxi) **Other** - 完善 DateTimePicker 文档 [834](https://github.com/taroify/taroify/pull/834) [@sweet7788](https://github.com/sweet7788) - 完善 FormItem 文档 [837](https://github.com/taroify/taroify/pull/837) [@Niubility-SunLight](https://github.com/Niubility-SunLight) - 完善 Form 文档 [847](https://github.com/taroify/taroify/pull/847) [@lvqq](https://github.com/lvqq) - 完善 Calendar 文档 [850](https://github.com/taroify/taroify/pull/853) [@CodeMak1r-zy](https://github.com/CodeMak1r-zy) - lodash 支持 tree shaking [851](https://github.com/taroify/taroify/pull/851) [@hbztd](https://github.com/hbztd) ### v0.5.1-alpha.0 `2024-10-28` **Feature** - SafeArea - 新增 `nativeSafeTop` 属性,是否启用小程序顶部安全区高度 [830](https://github.com/taroify/taroify/pull/830) [@Pilotager](https://github.com/Pilotager) **Bug Fixes** - SafeArea - 修复安全区底部判断问题 [830](https://github.com/taroify/taroify/pull/830) [@Pilotager](https://github.com/Pilotager) ### v0.5.0-alpha.0 `2024-10-27` **Feature** - Cascader - 新增 `ellipsis` 属性 [817](https://github.com/taroify/taroify/pull/817) [@Pilotager](https://github.com/Pilotager) - Form - `FormItem` 添加 `validateFirst` 属性, 用于只返回第一个失败校验 [818](https://github.com/taroify/taroify/pull/818) [@Niubility-SunLight](https://github.com/Niubility-SunLight) **Bug Fixes** - Form - 修复设置 `controlAlign` right 后,feedback 没有向右对齐 [820](https://github.com/taroify/taroify/pull/820) [@Niubility-SunLight](https://github.com/Niubility-SunLight) - SafeArea - 优化小程序环境顶部安全区距离 [826](https://github.com/taroify/taroify/pull/826) [@CodeMak1r-zy](https://github.com/CodeMak1r-zy) - IndexList - 修复异步传入数据时 `anchorRects` 报错问题 [828](https://github.com/taroify/taroify/pull/828) [@Pilotager](https://github.com/Pilotager) **Other** - `SafeArea` 新增单测[826](https://github.com/taroify/taroify/pull/826) [@CodeMak1r-zy](https://github.com/CodeMak1r-zy) ### v0.4.2-alpha.0 `2024-10-13` **Bug Fixes** - Cascader - 修复不能上下滑动问题 [813](https://github.com/taroify/taroify/pull/813) [@Pilotager](https://github.com/Pilotager) - Uploader - 修复图片加载中或者未加载出来样式问题 [814](https://github.com/taroify/taroify/pull/814) [@Pilotager](https://github.com/Pilotager) ### v0.4.1-alpha.0 `2024-09-22` **Bug Fixes** - Icon - 修复 icon css 后加载导致 `Rate` 没有颜色 [804](https://github.com/taroify/taroify/pull/804) [@hbztd](https://github.com/hbztd) - Tabbar - 修复 `Tabbar.TabItem` icon className 丢失 [804](https://github.com/taroify/taroify/pull/804) [@hbztd](https://github.com/hbztd) - Uploader - 修复 `Uploader` 自定义样式,无法触发 `onUpload` [804](https://github.com/taroify/taroify/pull/804) [@hbztd](https://github.com/hbztd) - Form - 修复 Form rules 某些情况下,trigger 过滤错误 [804](https://github.com/taroify/taroify/pull/804) [@hbztd](https://github.com/hbztd) - 修复 Form Input 输入后立即调用 reset,未清空错误显示 [804](https://github.com/taroify/taroify/pull/804) [@hbztd](https://github.com/hbztd) **Other** - 完善 `Cell` 单测 [805](https://github.com/taroify/taroify/pull/805) [@Pilotager](https://github.com/Pilotager) ### v0.4.0-alpha.0 `2024-08-18` **Feature** - Search - 透传 `enableNative` 属性 [790](https://github.com/taroify/taroify/pull/790) [@Pilotager](https://github.com/Pilotager) - Toast - `duration` 为 `0` 时,提示不消失 [793](https://github.com/taroify/taroify/pull/793) [@Pilotager](https://github.com/Pilotager) - Tag - 添加边框颜色 `css` 变量 [801](https://github.com/taroify/taroify/pull/801) [@hbztd](https://github.com/hbztd) - Circle - 重构,WEB 和小程序都使用 `Canvas 2D` 接口实现 [801](https://github.com/taroify/taroify/pull/801) [@hbztd](https://github.com/hbztd) - 添加 `startPosition` 属性 [801](https://github.com/taroify/taroify/pull/801) [@hbztd](https://github.com/hbztd) **Bug Fixes** - NumberKeyboard - 优化按钮字体大小 [788](https://github.com/taroify/taroify/pull/788) [@Pilotager](https://github.com/Pilotager) - Cascader - 修复 `Cascader` 第一次打开时动画卡顿 [801](https://github.com/taroify/taroify/pull/801) [@hbztd](https://github.com/hbztd) - Popup - 修复 `duration` 属性不起作用 [801](https://github.com/taroify/taroify/pull/801) [@hbztd](https://github.com/hbztd) - Backdrop - 修复 `duration` 属性不起作用 [801](https://github.com/taroify/taroify/pull/801) [@hbztd](https://github.com/hbztd) **Other** - 完善 `FixedNav` 文档 [789](https://github.com/taroify/taroify/pull/789) [@Pilotager](https://github.com/Pilotager) - `Progress` 文档更新 [799](https://github.com/taroify/taroify/pull/799) [@Pilotager](https://github.com/Pilotager) - 内置样式添加触摸反馈 [801](https://github.com/taroify/taroify/pull/801) [@hbztd](https://github.com/hbztd) ### v0.3.2-alpha.0 `2024-08-04` **Feature** - Image - 添加 `width` `height` 属性 [784](https://github.com/taroify/taroify/pull/784) [@hbztd](https://github.com/hbztd) **Bug Fixes** - Empty - 修复 `Empty` 组件图片居中问题 [779](https://github.com/taroify/taroify/pull/779) [@CodeMak1r-zy](https://github.com/CodeMak1r-zy) - FloatingBubble - 修复 `sass` 变量未进行适配 [782](https://github.com/taroify/taroify/pull/782) [@Pilotager](https://github.com/Pilotager) - Image - 修复加载中未显示 `placeholder` [784](https://github.com/taroify/taroify/pull/784) [@hbztd](https://github.com/hbztd) ### v0.3.1-alpha.0 `2024-07-09` **Feature** - Form - Form 添加 `disabled` 属性,实例添加 `submit` 方法 [767](https://github.com/taroify/taroify/pull/767) [@hbztd](https://github.com/hbztd) **Bug Fixes** - BackTop - Scss 添加 `$hd` 变量配置 [762](https://github.com/taroify/taroify/pull/762) [@Pilotager](https://github.com/Pilotager) - FixedNav - Scss 添加 `$hd` 变量配置 [768](https://github.com/taroify/taroify/pull/768) [@Pilotager](https://github.com/Pilotager) - Form - 修复 `Checkbox.Group` 设置 `disabled` 无效 [767](https://github.com/taroify/taroify/pull/767) [@hbztd](https://github.com/hbztd) - Avatar - 修复 `Avatar` 里为图片时,样式不对 [777](https://github.com/taroify/taroify/pull/767) [@hbztd](https://github.com/hbztd) - `Image` 默认继承父元素宽高 [777](https://github.com/taroify/taroify/pull/767) [@hbztd](https://github.com/hbztd) **Other** - 修复 `taro` 预编译 `@taroify/core` `@taroify/icons` 失败 [763](https://github.com/taroify/taroify/pull/763) [@hbztd](https://github.com/hbztd) - package.json 添加 `repository` 和 `bugs` [764](https://github.com/taroify/taroify/pull/764) [@Pilotager](https://github.com/Pilotager) ### v0.3.0-alpha.0 `2024-06-23` **Feature** - Flex - 为 `flex align` 添加了初始属性 [753](https://github.com/taroify/taroify/pull/753) [@sehmbimanvir](https://github.com/sehmbimanvir) - Badge - 重构 `Badge` 组件,`Grid` `Sidebar` `Tabbar` `Tabs` `TreeSelect` 组件徽标相关代码调整 [754](https://github.com/taroify/taroify/pull/754) [@hbztd](https://github.com/hbztd) - Icon - 支持自定义图标 [754](https://github.com/taroify/taroify/pull/754) [@hbztd](https://github.com/hbztd) - ActionSheet - 添加 actions,description, cancelText 属性 [760](https://github.com/taroify/taroify/pull/760) [@hbztd](https://github.com/hbztd) **Bug Fixes** - CountDown - 修复 Countdown 组件在卸载时仍然继续执行倒计时并触发 onComplete [760](https://github.com/taroify/taroify/pull/760) [@hbztd](https://github.com/hbztd) - ActionSheet - 修复 loading 和 disabled 属性不起作用 [760](https://github.com/taroify/taroify/pull/760) [@hbztd](https://github.com/hbztd) **Other** - 修复 `@taroify/core` `@taroify/icons`,taro 预编译失败 [755](https://github.com/taroify/taroify/pull/755) [@hbztd](https://github.com/hbztd) - 删除 babel 转换和 sourcemap 文件[755](https://github.com/taroify/taroify/pull/755) [@hbztd](https://github.com/hbztd) ### v0.2.3-alpha.0 `2024-06-02` **Bug Fixes** - Cascader - 修复级联选择 `options` 无法设置为空 [746](https://github.com/taroify/taroify/pull/746) [@hbztd](https://github.com/hbztd) - Calendar - 修复日历 `subtitle` 在手动设置 `value` 时,可能出现显示错误 [747](https://github.com/taroify/taroify/pull/747) [@hbztd](https://github.com/hbztd) **Feature** - DropdownMenu - 背景板添加类型 [748](https://github.com/taroify/taroify/pull/748) [@Pilotager](https://github.com/Pilotager) **Other** - 文档代码示例添加复制按钮 [746](https://github.com/taroify/taroify/pull/746) [@hbztd](https://github.com/hbztd) - 更新文档内示例以及属性 [747](https://github.com/taroify/taroify/pull/747) [@hbztd](https://github.com/hbztd) ### v0.2.2-alpha.1 `2024-05-30` **Bug Fixes** - Tabbar - 修复 `Tabbar icon` 传递 `ReactNode` 丢失原有 `className` [736](https://github.com/taroify/taroify/pull/736) [@wenqiyun](https://github.com/wenqiyun) - Signature - 修复 `getWindowInfo` 在抖音小程序报错问题 [738](https://github.com/taroify/taroify/pull/736) [@Pilotager](https://github.com/Pilotager) - PullRefresh - 修复小程序环境内 `throttle` 报 `now of undefined` [743](https://github.com/taroify/taroify/pull/743) [@Pilotager](https://github.com/Pilotager) ### v0.2.2-alpha.0 `2024-05-19` **Bug Fixes** - Input - 修复 `readonly` 属性 [731](https://github.com/taroify/taroify/pull/731) [@SexySix](https://github.com/SexySix) - Form - 修复 `Form.Label`设置 `className` 后,组件本身 `className` 被覆盖 [733](https://github.com/taroify/taroify/pull/733) [@hbztd](https://github.com/hbztd) - 修复 `Form.Item`、`isLink` 属性不起作用 [733](https://github.com/taroify/taroify/pull/733) [@hbztd](https://github.com/hbztd) - BackTop - 组件默认高亮颜色应该从 `--primary-color` 取,而不是 `--blue` [734](https://github.com/taroify/taroify/pull/734) [@hbztd](https://github.com/hbztd) - Badge - 组件默认高亮颜色应该从 `--primary-color` 取,而不是 `--blue` [734](https://github.com/taroify/taroify/pull/734) [@hbztd](https://github.com/hbztd) - NavBar - 组件默认高亮颜色应该从 `--primary-color` 取,而不是 `--blue` [734](https://github.com/taroify/taroify/pull/734) [@hbztd](https://github.com/hbztd) - Pagination - 组件默认高亮颜色应该从 `--primary-color` 取,而不是 `--blue` [734](https://github.com/taroify/taroify/pull/734) [@hbztd](https://github.com/hbztd) - Slider - 组件默认高亮颜色应该从 `--primary-color` 取,而不是 `--blue` [734](https://github.com/taroify/taroify/pull/734) [@hbztd](https://github.com/hbztd) - Swiper - 组件默认高亮颜色应该从 `--primary-color` 取,而不是 `--blue` [734](https://github.com/taroify/taroify/pull/734) [@hbztd](https://github.com/hbztd) - Tabbar - 组件默认高亮颜色应该从 `--primary-color` 取,而不是 `--blue` [734](https://github.com/taroify/taroify/pull/734) [@hbztd](https://github.com/hbztd) ### v0.2.1-alpha.0 `2024-05-10` **Feature** - IndexList - 添加 `showSidebar` 和 `onChange` 属性 [723](https://github.com/taroify/taroify/pull/723) [@Pilotager](https://github.com/Pilotager) - 添加手动调用 `scrollTo` 方法 [724](https://github.com/taroify/taroify/pull/724) [@Pilotager](https://github.com/Pilotager) ### v0.2.0-alpha.0 `2024-05-09` **Feature** - IndexList - 添加底部弹窗内使用方式 [721](https://github.com/taroify/taroify/pull/721) [@Pilotager](https://github.com/Pilotager) **Other** - Taro 相关依赖项改为 >=3 [721](https://github.com/taroify/taroify/pull/721) [@Pilotager](https://github.com/Pilotager) ### v0.1.7-alpha.0 `2024-04-28` **Feature** - Dropdown - DropdownMenuItem: 支持 `lock` 和 `options` 属性 [718](https://github.com/taroify/taroify/pull/718) [@hbztd](https://github.com/hbztd) **Bug Fixes** - Flex - 修复 `flex` 在 `wrap` 情况下,如果设置了 `gutter`, 换行后首个元素错位 [712](https://github.com/taroify/taroify/pull/712) [@Pilotager](https://github.com/Pilotager) - DatetimePicker - 修复 `DatetimePicker` 可选择月和日的情况下,由于代码中先设置月份,会导致所有最后一天小于 `minDate` 的日的月份被设置为下一个月 [714](https://github.com/taroify/taroify/pull/714) [@SexySix](https://github.com/SexySix) - Swiper - 修复 `SwiperItem` 初始化后再渲染 [717](https://github.com/taroify/taroify/pull/717) [@hbztd](https://github.com/hbztd) - 修复在微信上 `TabsHeader` 滚动时,不应显示滚动条 [717](https://github.com/taroify/taroify/pull/717) [@hbztd](https://github.com/hbztd) - Dropdown - 修复 `Search` 有两个 X [718](https://github.com/taroify/taroify/pull/718) [@hbztd](https://github.com/hbztd) ### v0.1.6-alpha.0 `2024-03-24` **Feature** - Form - Form.Item 添加 `dependencies` `shouldUpdate` `noStyle` 属性 [705](https://github.com/taroify/taroify/pull/705) [@hbztd](https://github.com/hbztd) **Bug Fixes** - Grid - 修复 `children` 为 null 引发的错误问题 [703](https://github.com/taroify/taroify/pull/703) [@Hector-Chong](https://github.com/Hector-Chong) - Form - 修复 Form.Item 点击报错(taro>=3.6.23 事件绑定 undefined 触发时报错) [705](https://github.com/taroify/taroify/pull/705) [@hbztd](https://github.com/hbztd) - 修复 Field 未提供 FormItemInstance [705](https://github.com/taroify/taroify/pull/705) [@hbztd](https://github.com/hbztd) - Style - 修复 `Radio` 和 `Checkbox` 默认字体大小比其他大,`Input` 和 `Textarea` 字体不一致问题 [706](https://github.com/taroify/taroify/pull/706) [@hbztd](https://github.com/hbztd) - 修复 `Form` 右对齐时,\*位置不对问题 [706](https://github.com/taroify/taroify/pull/706) [@hbztd](https://github.com/hbztd) - FloatingPanel - 修复 `FloatingPanel` 无法向下滑动关闭问题 [709](https://github.com/taroify/taroify/pull/709) [@Pilotager](https://github.com/Pilotager) **Other** - 升级 Taro 版本为 3.6.23 [700](https://github.com/taroify/taroify/pull/700) [@Pilotager](https://github.com/Pilotager) - Button 测试率覆盖 100% [701](https://github.com/taroify/taroify/pull/701) [@sehmbimanvir](https://github.com/sehmbimanvir) - 修复 Form 组件文档内连接链接多了前缀 [705](https://github.com/taroify/taroify/pull/705) [@hbztd](https://github.com/hbztd) ### v0.1.5-alpha.0 `2024-02-19` **Bug Fixes** - Loading - 修复 `addUnitPx` 判断条件错误 [693](https://github.com/taroify/taroify/pull/693) [@sehmbimanvir](https://github.com/sehmbimanvir) **Feature** - Popup - `placement` 添加 `center` 选项 [690](https://github.com/taroify/taroify/pull/690) [@Hector-Chong](https://github.com/Hector-Chong) **Other** - 修复 `jest` 配置错误导致 `yarn test` 报错问题 [691](https://github.com/taroify/taroify/pull/691) [@sehmbimanvir](https://github.com/sehmbimanvir) - 完善 `NavBar` 测试用例 [692](https://github.com/taroify/taroify/pull/692) [@sehmbimanvir](https://github.com/sehmbimanvir) - 完善 `FixedNav` 测试用例 [694](https://github.com/taroify/taroify/pull/694) [@Pilotager](https://github.com/Pilotager) - 完善 `FloatingPanel` 测试用例 [695](https://github.com/taroify/taroify/pull/695) [@Pilotager](https://github.com/Pilotager) **Doc** - npm 文档更新 [698](https://github.com/taroify/taroify/pull/698) [@Pilotager](https://github.com/Pilotager) ### v0.1.4-alpha.0 `2024-02-09` **Bug Fixes** - Input - 修复 Input 组件的 `font-size` 无法被正常继承问题 [680](https://github.com/taroify/taroify/pull/680) [@Hector-Chong](https://github.com/Hector-Chong) - Radio - 添加泛型 [681](https://github.com/taroify/taroify/pull/681) [@Hector-Chong](https://github.com/Hector-Chong) - Checkbox - 添加泛型 [681](https://github.com/taroify/taroify/pull/681) [@Hector-Chong](https://github.com/Hector-Chong) - AreaSelector - 修复值未定义时异常处理 [682](https://github.com/taroify/taroify/pull/682) [@Hector-Chong](https://github.com/Hector-Chong) - Uploader - `onChange` 事件添加优化类型定义 [683](https://github.com/taroify/taroify/pull/683) [@Hector-Chong](https://github.com/Hector-Chong) - Popup - 去除 console [684](https://github.com/taroify/taroify/pull/684) [@Pilotager](https://github.com/Pilotager) - FixedNav - 去除 console [685](https://github.com/taroify/taroify/pull/685) [@Pilotager](https://github.com/Pilotager) **Feature** - Popup - 添加 `lock` 属性以及 H5 禁止滚动穿透 [679](https://github.com/taroify/taroify/pull/679) [@Pilotager](https://github.com/Pilotager) ### v0.1.3-alpha.1 `2024-02-04` **Bug Fixes** - Input - 修复 `Input` 在只读模式下字体颜色问题 [674](https://github.com/taroify/taroify/pull/674) [@Pilotager](https://github.com/Pilotager) - Flex - 修复 `Flex` 无法渲染文本节点(导致 `Timeline` 无法渲染) [676](https://github.com/taroify/taroify/pull/676) [@hbztd](https://github.com/hbztd) **Doc** - 优化线上打开文档页面会闪一下 [675](https://github.com/taroify/taroify/pull/675) [@hbztd](https://github.com/hbztd) - 优化文档内跳转 [675](https://github.com/taroify/taroify/pull/675) [@hbztd](https://github.com/hbztd) - 链接地址修复 [675](https://github.com/taroify/taroify/pull/675) [@hbztd](https://github.com/hbztd) ### v0.1.3-alpha.0 `2024-02-02` **Bug Fixes** - Image - 修复 `Image` 组件快速加载样式问题 [668](https://github.com/taroify/taroify/pull/668) [@Pilotager](https://github.com/Pilotager) - Flex - 优化 `Flex` 两边间距 [669](https://github.com/taroify/taroify/pull/669) [@Pilotager](https://github.com/Pilotager) - Watermark - 修复 `Watermark` 样式引入问题 [670](https://github.com/taroify/taroify/pull/670) [@sehmbimanvir](https://github.com/sehmbimanvir) **Feature** - Popup - `Popup` 居中弹出添加圆角属性 [672](https://github.com/taroify/taroify/pull/672) [@Pilotager](https://github.com/Pilotager) **Doc** - Popup:添加居中弹出圆角示例 - Popup:添加自定义图标示例 - Flex: 优化示例内代码 ### v0.1.2-alpha.0 `2024-01-27` **Bug Fixes** - AreaPicker - 修复 AreaPicker 选中确认报错问题 [664](https://github.com/taroify/taroify/pull/664) [@Pilotager](https://github.com/Pilotager) **Feature** - FixedNav - 添加 FixedNav 组件 [662](https://github.com/taroify/taroify/pull/662) [@Pilotager](https://github.com/Pilotager) - FloatingPanel - 优化反弹动画 [661](https://github.com/taroify/taroify/pull/661) [@Pilotager](https://github.com/Pilotager) - Watermark - 添加 CSS Variables 类型 [665](https://github.com/taroify/taroify/pull/665) [@Pilotager](https://github.com/Pilotager) **Doc** - 完善 Tab 文档,添加 `dot` `badge` 属性 [660](https://github.com/taroify/taroify/pull/660) [@Pilotager](https://github.com/Pilotager) - 添加全文搜索功能 [666](https://github.com/taroify/taroify/pull/666) [@Pilotager](https://github.com/Pilotager) ### v0.1.1-alpha.11 `2024-01-21` **Bug Fixes** - Popup - 修复滚动穿透问题 [657](https://github.com/taroify/taroify/pull/657) [@Pilotager](https://github.com/Pilotager) **Feature** - Tabs - 添加 `dot` 和 `badge` 属性 [655](https://github.com/taroify/taroify/pull/655) [@Pilotager](https://github.com/Pilotager) - Watermark - 添加 Watermark 水印 [658](https://github.com/taroify/taroify/pull/658) [@hbztd](https://github.com/hbztd) ### v0.1.1-alpha.10 `2024-01-01` **Bug Fixes** - Form - 修复 CellTitle 导入问题 [651](https://github.com/taroify/taroify/pull/651) [@Pilotager](https://github.com/Pilotager) ### v0.1.1-alpha.9 `2023-12-15` **Feature** - TextEllipsis - 添加 TextEllipsis 文字省略组件 [646](https://github.com/taroify/taroify/pull/646) [@hbztd](https://github.com/hbztd) ### v0.1.1-alpha.8 `2023-12-07` **Bug Fixes** - DatetimePicker - 修复 DatetimePicker 多了一个空白 [643](https://github.com/taroify/taroify/pull/643) [@Pilotager](https://github.com/Pilotager) ### v0.1.1-alpha.7 `2023-11-28` **Feature** - AreaPicker - 添加 `areaList` `title` `confirmText` `cancelText` `optionHeight`, 支持通过属性配置 AreaPicker [639](https://github.com/taroify/taroify/pull/639) [@hbztd](https://github.com/hbztd) **Bug Fixes** - AreaPicker - 修复 AreaPicker 多了一个空白 [639](https://github.com/taroify/taroify/pull/639) [@hbztd](https://github.com/hbztd) - Picker - 修复选项文字内容超长时未省略 [639](https://github.com/taroify/taroify/pull/639) [@hbztd](https://github.com/hbztd) ### v0.1.1-alpha.6 `2023-11-14` **Feature** - Calendar - 添加 `poppable` `showPopup` `onClose` 属性,支持弹框展示日历 [636](https://github.com/taroify/taroify/pull/636) [@hbztd](https://github.com/hbztd) - 添加 `showConfirm` `confirmText` `confirmDisabledText`,支持自定义确认按钮文案 [636](https://github.com/taroify/taroify/pull/636) [@hbztd](https://github.com/hbztd) - 添加 `showSubtitle`,修改 `subtitle`,支持自定义副标题 [636](https://github.com/taroify/taroify/pull/636) [@hbztd](https://github.com/hbztd) **Bug Fixes** - Navbar - 修复 `placeholder` 属性值默认为 false [634](https://github.com/taroify/taroify/pull/634) [@Pilotager](https://github.com/Pilotager) - Tabs - 修复 TabPane 内容 DOM 上不该有 `title` 属性 [635](https://github.com/taroify/taroify/pull/635) [@hbztd](https://github.com/hbztd) - Calendar - 修复日历在 h5 无法滑动 - 修复设置 defaultValue,value 没有跳转到对应位置 - 修复底部按钮在微信小程序里颜色不对 ### v0.1.1-alpha.5 `2023-11-05` **Feature** - Picker - 添加 `optionHeight` 属性,支持配置选项高度 [629](https://github.com/taroify/taroify/pull/629) [@hbztd](https://github.com/hbztd) - 添加 `title` `confirmText` `cancelText` `columns` `columnsFieldNames`,支持通过数据配置选项 [629](https://github.com/taroify/taroify/pull/629) [@hbztd](https://github.com/hbztd) - Cell - Cell(Form.Item, Field) 添加 `isLink` `arrowDirection` 属性 [630](https://github.com/taroify/taroify/pull/630) [@hbztd](https://github.com/hbztd) - Icon [631](https://github.com/taroify/taroify/pull/631) [@Pilotager](https://github.com/Pilotager) - 图标:添加一个实底的 records 图标 - 图标:添加一个实底的 contact 图标 - 图标:添加一个实底的 discount 图标 - 图标:添加一个实底的 completed 图标 - 图标:添加一个实底的 description 图标 - 图标:添加一个实底的 cash-back-record 图标 - 图标:添加新的 user 图标 - 图标:添加新的 notes 图标 - 图标:添加新的 newspaper 图标 - 图标:添加新的 list-switch 图标 - 图标:添加新的 list-switching 图标 - 图标:将 records 图标重命名为 records-o - 图标:将 contact 图标重命名为 contact-o - 图标:将 discount 图标重命名为 discount-o - 图标:将 completed 图标重命名为 completed-o - 图标:将 description 图标重命名为 description-o - 图标:将 cash-back-record 图标重命名为 cash-back-record-o **Bug Fixes** - Picker - 修复 siblingCount 属性未生效 [629](https://github.com/taroify/taroify/pull/629) [@hbztd](https://github.com/hbztd) ### v0.1.1-alpha.4 `2023-10-27` **Feature** - Cascader - 添加 `options` `fieldNames` `loadData`,支持指定数据源,自定义 options 结构中的字段,动态加载选项 [626](https://github.com/taroify/taroify/pull/626) [@hbztd](https://github.com/hbztd) - `useCascader` 添加缓存,提高性能 [626](https://github.com/taroify/taroify/pull/626) [@hbztd](https://github.com/hbztd) **Bug Fixes** - Swiper - 修复动态设置 SwiperItem 时可能出现页面异常 [626](https://github.com/taroify/taroify/pull/626) [@hbztd](https://github.com/hbztd) - Filed - 修复单独使用 Filed 时,form 为空报错 [627](https://github.com/taroify/taroify/pull/627) [@hbztd](https://github.com/hbztd) ### v0.1.1-alpha.3 `2023-10-26` **Feature** - Form - Form 表单支持动态增减表单项 [622](https://github.com/taroify/taroify/pull/622) [@hbztd](https://github.com/hbztd) - NoticeBar - 添加 `reset` 实例方法 [#623](https://github.com/taroify/taroify/pull/623) [@hbztd](https://github.com/hbztd) - `NoticeBarIcon` 和 `NoticeBarAction` onClick 阻止冒泡触发 NoticeBar Click 事件 [#623](https://github.com/taroify/taroify/pull/623) [@hbztd](https://github.com/hbztd) **Bug Fixes** - NoticeBar - 修复 `onReplay` 未触发 [#623](https://github.com/taroify/taroify/pull/623) [@hbztd](https://github.com/hbztd) ### v0.1.1-alpha.2 `2023-10-13` **New Component** - 新增 Signature 组件 [#618](https://github.com/taroify/taroify/pull/618) [@hbztd](https://github.com/hbztd) **Feature** - Space - 支持自定间距,添加 `fill` 属性 [#619](https://github.com/taroify/taroify/pull/619) [@hbztd](https://github.com/hbztd) - List - 重构 List 实现。删除 `scrollTop`、`onLoading`,添加 `fixedHeight`、`immediateCheck`、`disabled`、`check` [#620](https://github.com/taroify/taroify/pull/620) [@hbztd](https://github.com/hbztd) ### v0.1.1-alpha.1 `2023-09-29` **New Component** - 新增 FloatingBubble 组件 [#610](https://github.com/taroify/taroify/pull/610) [@Pilotager](https://github.com/Pilotager) **Feature** - DropdownMenu - 新增 `onOpen` `onClose` `onOpened` `onClosed` 事件 [#612](https://github.com/taroify/taroify/pull/612) [@hbztd](https://github.com/hbztd) **Bug Fixes** - Input - 修复设置 readonly 属性的,原生 input dom 上是 disabled,会导致无法聚焦触发 onClick,电脑上 h5 调试打不开 Picker [#613](https://github.com/taroify/taroify/pull/613) [@hbztd](https://github.com/hbztd) - Image - 修复 img onload 不一定触发问题 [#614](https://github.com/taroify/taroify/pull/614) [@hbztd](https://github.com/hbztd) - Tabs - Tabs 设置 lazyRender 属性后,会加载当前,前后选项卡,和预期不符(延迟渲染未展示的选项卡) [#615](https://github.com/taroify/taroify/pull/615) [@hbztd](https://github.com/hbztd) ### v0.1.1-alpha.0 `2023-09-17` **Feature** - Button - 添加 `iconPosition` 属性 [#606](https://github.com/taroify/taroify/pull/606) [@Pilotager](https://github.com/Pilotager) - Taro 版本升级为 v3.6.16 [#607](https://github.com/taroify/taroify/pull/607) [@Pilotager](https://github.com/Pilotager) ### v0.1.0-alpha.12 `2023-09-04` **Bug Fixes** - Button - 消除 `key` 警告 [#596](https://github.com/taroify/taroify/pull/596) [@rtmax0](https://github.com/rtmax0) - Avatar - 修复群组使用 `size` 属性时最后一个元素尺寸问题 [#600](https://github.com/taroify/taroify/pull/600) [@Pilotager](https://github.com/Pilotager) - Picker - 修复滚动时卡顿问题 [#601](https://github.com/taroify/taroify/pull/601) [@Pilotager](https://github.com/Pilotager) ### v0.1.0-alpha.11 `2023-08-21` **Bug Fixes** - IndexList - 修复微信小程序端点击事件报错 [#592](https://github.com/taroify/taroify/pull/592) [@450669540](https://github.com/450669540) ### v0.1.0-alpha.10 `2023-08-11` **Feature** - Stepper - 新增 `cursor` 属性 [#590](https://github.com/taroify/taroify/pull/590) [@Pilotager](https://github.com/Pilotager) ### v0.1.0-alpha.9 `2023-07-27` **Feature** - Pagination - 新增 `prevText`、`nextText`、`mode` 属性 [#588](https://github.com/taroify/taroify/pull/588) [@Pilotager](https://github.com/Pilotager) - Navbar - 完善文档 [#587](https://github.com/taroify/taroify/pull/587)[@Pilotager](https://github.com/Pilotager) ### v0.1.0-alpha.8 `2023-07-19` **Feature** - Taro 版本升级为 v3.6.8 [#583](https://github.com/taroify/taroify/pull/583) [@Pilotager](https://github.com/Pilotager) - Tab - 新增 swipeThreshold 属性 [#585](https://github.com/taroify/taroify/pull/585) [@Pilotager](https://github.com/Pilotager) ### v0.1.0-alpha.7 `2023-07-13` **Feature** - 统一了所有组件的主色调,所有组件均采用蓝色作为主色调 [#578](https://github.com/taroify/taroify/pull/578) [@Pilotager](https://github.com/Pilotager) - 完善了主题变量的类型定义,`ConfigProviderThemeVars` 类型 [#579](https://github.com/taroify/taroify/pull/579) [@Pilotager](https://github.com/Pilotager) ### v0.1.0-alpha.6 `2023-07-09` **New Component** - 新增 RollingText 组件 [#574](https://github.com/taroify/taroify/pull/574) [@Pilotager](https://github.com/Pilotager) **Bug Fixes** - Tab - 修复 Tab 中 `ellipsis` 属性样式问题 [#576](https://github.com/taroify/taroify/pull/576) - Collapse - 修复 Collapse 折叠面板无法全部关闭问题 [#576](https://github.com/taroify/taroify/pull/576) ### v0.1.0-alpha.5 `2023-07-06` **Bug Fixes** - Tag - 修复 Tag 组件圆角属性不生效问题 [#570](https://github.com/taroify/taroify/pull/570) [@Pilotager](https://github.com/Pilotager) - NavBar - 修复 NavBar 层级导致的被覆盖问题 [#571](https://github.com/taroify/taroify/pull/571) [@Pilotager](https://github.com/Pilotager) - Skeleton - 修改 Skeleton 文档问题 [#557](https://github.com/taroify/taroify/pull/557) [@Youmeng](https://github.com/youmengme) - IndexList - 修复 IndexList 组件首次点击右侧快捷跳转问题 [#572](https://github.com/taroify/taroify/pull/572) [@Pilotager](https://github.com/Pilotager) - Form - Input 校验未通过时,placeholder 颜色优化 [#503](https://github.com/taroify/taroify/issues/503) ### v0.1.0-alpha.4 `2023-06-30` **New Component** - 新增 BackTop 组件 [#568](https://github.com/taroify/taroify/pull/568) [@Pilotager](https://github.com/Pilotager) ### v0.1.0-alpha.3 `2023-06-26` **New Component** - 新增 FloatingPanel 组件 [#564](https://github.com/taroify/taroify/pull/564) [@Pilotager](https://github.com/Pilotager) ### v0.1.0-alpha.1 `2022-06-26` **Bug Fixes** - Icons - 修复在飞书小程序图标不显示的问题 [#511](https://github.com/taroify/taroify/issues/511) [#519](https://github.com/taroify/taroify/issues/519) [#520](https://github.com/taroify/taroify/pull/520) ### v0.1.0-alpha.0 `2022-06-21` **Feature** - 更新 @tarojs/\* 版本至 3.4.10 [#a2864f3](https://github.com/taroify/taroify/commit/a2864f319b0eddde8006444a6a41be3a0e78b07a) [#9a2d5eb](https://github.com/taroify/taroify/commit/9a2d5ebc19d466902952d98ab749eaa7613ce1ff) [#b722781](https://github.com/taroify/taroify/commit/b722781d3a58a294d43065aea8e6bf12691d1fc4) **Bug Fixes** - 修复 safe-area.scss 样式未导入的问题 [#493](https://github.com/taroify/taroify/pull/493) [@peng](https://github.com/pengcu) - SwipeCell - 修复 catch move 的问题 [#495](https://github.com/taroify/taroify/pull/495) [@Kyle](https://github.com/jhxxs) - Loading - 修复 SCSS 样式编译警告的问题 [#497](https://github.com/taroify/taroify/pull/497) [@Fen QIN](https://github.com/umcai) - Button - 更新 shape 属性文档不一致的问题 [#512](https://github.com/taroify/taroify/pull/512) [@Kuntang Huang](https://github.com/kunkuntang) ### v0.0.29-alpha.9 `2022-05-30` **Bug Fixes** - Cascader - 修复没用触发 onSelect 事件的问题 [#484](https://github.com/taroify/taroify/pull/484) - Avatar - 修复没用按需加载 Image 样式的问题 [#480](https://github.com/taroify/taroify/pull/480) [@ShibaPipi](https://github.com/ShibaPipi) ### v0.0.29-alpha.8 `2022-04-27` **Feature** - CSS Vars - 优化全部组件的 CSS Vars 文档 [#392](https://github.com/taroify/taroify/issues/392) **Bug Fixes** - Swiper - 修复切换存在白屏的问题 [#472](https://github.com/taroify/taroify/issues/472) [#474](https://github.com/taroify/taroify/pull/474) [@Laotree](https://github.com/Laotree) ### v0.0.29-alpha.7 `2022-04-12` **Bug Fixes** - Swiper - 修复 targetOffset 为 0 的问题 [#461](https://github.com/taroify/taroify/pull/461) - Tabs - 修复开启滑动,无法滚动页面的问题 [#463](https://github.com/taroify/taroify/pull/463) ### v0.0.29-alpha.6 `2022-04-09` **Breaking Changes** - Search - 将 shape="round" 属性重命名为 shape="rounded" [#444](https://github.com/taroify/taroify/issues/444) [#458](https://github.com/taroify/taroify/pull/458) - Dialog - 将 shape="round" 属性重命名为 shape="rounded" [#456](https://github.com/taroify/taroify/issues/456) [#457](https://github.com/taroify/taroify/pull/457) ### v0.0.29-alpha.5 `2022-04-06` **Feature** - Progress - 导出 ProgressProps 类型 [#437](https://github.com/taroify/taroify/pull/437) [@bingtsingw](https://github.com/bingtsingw) **Bug Fixes** - NoticeBar - 修复 rect 为 undefined [#438](https://github.com/taroify/taroify/pull/438) **Breaking Changes** - PasswordInput - 删除 error 属性 [#440](https://github.com/taroify/taroify/issues/440) - 将 info 属性重命名为 feedback [#440](https://github.com/taroify/taroify/issues/440) - Search - 将 shape="round" 属性重命名为 shape="circular" [#444](https://github.com/taroify/taroify/issues/444) - Stepper - 将 shape="round" 属性重命名为 shape="circular" [#449](https://github.com/taroify/taroify/issues/449) ### v0.0.29-alpha.4 `2022-04-01` **Bug Fixes** - DropdownMenu - 修复弹出抖动两次的问题 [#426](https://github.com/taroify/taroify/issues/426) [#436](https://github.com/taroify/taroify/pull/436) ### v0.0.29-alpha.3 `2022-03-29` **Feature** - Textarea - 导出 TextareaProps 类型 [#425](https://github.com/taroify/taroify/pull/425) [@bingtsingw](https://github.com/bingtsingw) **Bug Fixes** - Popup - 修复弹出抖动两次的问题 [#404](https://github.com/taroify/taroify/issues/404) [#431](https://github.com/taroify/taroify/pull/431) - styles - 删除重复 $text-link-color 变量 [#427](https://github.com/taroify/taroify/pull/427) [@Yorksh1re](https://github.com/Yorksh1re) ### v0.0.29-alpha.2 `2022-03-23` **Bug Fixes** - Button - 修复微信端不能编译 SCSS 样式的问题 [#422](https://github.com/taroify/taroify/issues/422) [#423](https://github.com/taroify/taroify/pull/423) ### v0.0.29-alpha.1 `2022-03-22` **Bug Fixes** - Tabbar - 修复 FixedView 组件样式未导入的问题 [#419](https://github.com/taroify/taroify/pull/419) - 修复 placeholder=\{false} 无作用的问题 [#420](https://github.com/taroify/taroify/pull/420) - Navbar - 修复 FixedView 组件样式未导入的问题 [#419](https://github.com/taroify/taroify/pull/419) - 修复 placeholder=\{false} 无作用的问题 [#420](https://github.com/taroify/taroify/pull/420) - ActionBar - 修复 placeholder=\{false} 无作用的问题 [#420](https://github.com/taroify/taroify/pull/420) ### v0.0.29-alpha.0 `2022-03-22` **New Component** - 新增 Button.Group 组件 [#414](https://github.com/taroify/taroify/issues/414) [#416](https://github.com/taroify/taroify/pull/416) - 新增 FixedView 组件 [#413](https://github.com/taroify/taroify/issues/413) [#417](https://github.com/taroify/taroify/pull/417) **Feature** - Tabbar - 新增 safeArea 属性 [#417](https://github.com/taroify/taroify/pull/417) [#418](https://github.com/taroify/taroify/pull/418) - Navbar - 新增 safeArea 属性 [#417](https://github.com/taroify/taroify/pull/417) [#418](https://github.com/taroify/taroify/pull/418) - ActionBar - 新增 safeArea 属性 [#417](https://github.com/taroify/taroify/pull/417) [#418](https://github.com/taroify/taroify/pull/418) ### v0.0.28-alpha.1 `2022-03-16` **Bug Fixes** - Countdown - 修复监听 onChange 事件时,获得 value 不正确的问题 [#403](https://github.com/taroify/taroify/pull/403) - List - 修复重复加载(onLoad)的问题 [#406](https://github.com/taroify/taroify/pull/406) ### v0.0.28-alpha.0 `2022-03-11` **New Component** - 新增 Timeline 组件 [#395](https://github.com/taroify/taroify/pull/395) [@coderYarn](https://github.com/coderYarn) **Bug Fixes** - Form - 修复使用校验函数返回值处理错误的问题 [#400](https://github.com/taroify/taroify/pull/400) - Picker - 修复滑动结束后不更新列值的问题 [#401](https://github.com/taroify/taroify/pull/401) ### v0.0.27-alpha.6 `2022-02-28` **Feature** - List - 新增 loading, hasMore 函数返回值类型 [#385](https://github.com/taroify/taroify/pull/385) **Bug Fixes** - @taroify/core/index.scss - 修复没有导入 ButtonBase 组件样式的问题 [#389](https://github.com/taroify/taroify/pull/389) - List - 修复 loading 赋值的问题 [#390](https://github.com/taroify/taroify/pull/390) - DropdownMenu - 修复当初始化页面滑动时,获得 rect 为 undefined 的问题 [#391](https://github.com/taroify/taroify/pull/391) ### v0.0.27-alpha.5 `2022-02-22` **Bug Fixes** - ancestorCustomWrapper - 修复嵌套在 Block 组件内不能查询元素的问题 [#370](https://github.com/taroify/taroify/pull/370) [@ThomasTrainset](https://github.com/xdoer) - Image - 修复 onLoad, onError 未实现的问题 [#372](https://github.com/taroify/taroify/pull/372) [@yifeishu-com](https://github.com/yifeishu-com) - DatetimePicker - 修复快速滑动时,快速点击 onConfirm 获取值不正确问题 [#373](https://github.com/taroify/taroify/issues/373) [#380](https://github.com/taroify/taroify/pull/380) - Picker - 修复 options 为空时,导致 valueOptions 为 undefined 的问题 [#375](https://github.com/taroify/taroify/issues/375) [#378](https://github.com/taroify/taroify/pull/378) - ActionBar.IconButton - 修复 badge 导入路径的问题 [#376](https://github.com/taroify/taroify/issues/376) [#377](https://github.com/taroify/taroify/pull/377) ### v0.0.27-alpha.4 `2022-02-18` **Bug Fixes** - useForm - 修复 defaultValues 被覆盖的问题 [#368](https://github.com/taroify/taroify/pull/368) ### v0.0.27-alpha.3 `2022-02-18` ### v0.0.27-alpha.2 `2022-02-17` **Bug Fixes** - useForm - 修复调用重置(reset)时,获取 onValuesChange 事件的 allValues 形参不正确的问题 [#367](https://github.com/taroify/taroify/pull/367) ### v0.0.27-alpha.1 `2022-02-17` **Feature** - ellipsis - 合并 multi-ellipsis 为 ellipsis [#343](https://github.com/taroify/taroify/pull/343) [@yifeishu-com](https://github.com/yifeishu-com) - Docs - 完善开发指南 [#347](https://github.com/taroify/taroify/pull/347) [@Yang](https://github.com/programmer-yang) - addUnitPx - 新增 rpx 转换 px 的支持 [#361](https://github.com/taroify/taroify/pull/361) [@BluesCurry](https://github.com/bluescurry) - SwipeCell - 新增 beforeClose 方法 [#363](https://github.com/taroify/taroify/pull/363) **Bug Fixes** - useForm - 修复设置 values 无反应的问题 [#356](https://github.com/taroify/taroify/pull/356) - Form - 修复通过 ref 调用 reset() 不能更新视图的问题 [#358](https://github.com/taroify/taroify/pull/358) - 修复通过 ref 调用 reset() 不能触发 onReset 事件的问题 [#358](https://github.com/taroify/taroify/pull/358) - SwipeCell - 修复点击滑动按钮不能自动关闭的问题 [#363](https://github.com/taroify/taroify/pull/363) ### v0.0.27-alpha.0 `2022-02-11` **New Component** - 新增 @taroify/commerce 包 [#84](https://github.com/taroify/taroify/issues/84) - 新增 ActionBar 组件 [#341](https://github.com/taroify/taroify/pull/341) **Bug Fixes** - Tabs - 修复切换标签页会触发两次 onChange 事件的问题 [#336](https://github.com/taroify/taroify/issues/336) [#339](https://github.com/taroify/taroify/pull/339) - Skeleton - 修复设置动画无效果的问题 [#334](https://github.com/taroify/taroify/pull/334) ### v0.0.26-alpha.6 `2022-02-08` **Bug Fixes** - Badge - 修复独立模式 fixed 的问题 [#331](https://github.com/taroify/taroify/pull/331) - Button - 修复 loading 为 false 时,不能显示图标的问题 [#332](https://github.com/taroify/taroify/pull/332) [@yifeishu-com](https://github.com/yifeishu-com) ### v0.0.26-alpha.5 `2022-01-28` **Feature** - ShareSheet.Option - 新增 value 属性 [#328](https://github.com/taroify/taroify/pull/328) ### v0.0.26-alpha.4 `2022-01-28` **Bug Fixes** - Stepper - 修复获取手动输入值不正确的问题 [#326](https://github.com/taroify/taroify/pull/326) - Popup - 修复固定定位(fixed position)和动画(translate3d)联用的问题 [#327](https://github.com/taroify/taroify/pull/327) ### v0.0.26-alpha.3 `2022-01-28` **Bug Fixes** - Input - 修复字号(font-size)、行高(line-height)继承父元素样式的问题 [#325](https://github.com/taroify/taroify/pull/325) - 修复清除按钮点击无效果的问题 [#320](https://github.com/taroify/taroify/pull/320) - Textarea - 修复字号(font-size)、行高(line-height)继承父元素样式的问题 [#324](https://github.com/taroify/taroify/pull/324) - Form - 修复非表单环境下设置空字符串的问题 [#323](https://github.com/taroify/taroify/pull/323) - 修复嵌套 Input 组件不能自定义颜色的问题 [#323](https://github.com/taroify/taroify/pull/323) ### v0.0.26-alpha.2 `2022-01-27` **Bug Fixes** - ShareSheet - 修复 image 样式被覆盖的问题 [#316](https://github.com/taroify/taroify/pull/316) - Textarea - 修复设置 value 无效的问题 [#315](https://github.com/taroify/taroify/pull/315) ### v0.0.26-alpha.1 `2022-01-26` **Feature** - Form - 补全 FormInstance 类型 [#311](https://github.com/taroify/taroify/pull/311) **Bug Fixes** - useHeight - 修复 rect 为 undefined 的问题 [#312](https://github.com/taroify/taroify/pull/312) ### v0.0.26-alpha.0 `2022-01-26` **New Component** - 新增 Textarea 组件 [#297](https://github.com/taroify/taroify/pull/297) **Feature** - Field - 优化 label, feedback 属性 [#310](https://github.com/taroify/taroify/issues/310) [#299](https://github.com/taroify/taroify/pull/299) [@coderYarn](https://github.com/coderYarn) **Bug Fixes** - Avatar - 修复 className 无法传入的问题 [#308](https://github.com/taroify/taroify/pull/308) [@coderYarn](https://github.com/coderYarn) - Input - 修复独立于 Form 组件,无法赋值的问题 [#298](https://github.com/taroify/taroify/pull/298) - Button - 修复加载(loading)状态下还可以提交表单的问题 [#306](https://github.com/taroify/taroify/pull/306) - Grid.Item - 修复 badge 字号样式问题 [#309](https://github.com/taroify/taroify/pull/309) - Tabbar.Item - 修复 badge 字号样式问题 [#309](https://github.com/taroify/taroify/pull/309) ### v0.0.25-alpha.1 `2022-01-24` **Feature** - IndexList - 新增 stickyOffsetTop 字符串(string)类型 [#287](https://github.com/taroify/taroify/pull/287) [@bluescurry](https://github.com/bluescurry) - ActionSheet - 新增按钮(Button)相关属性 [#292](https://github.com/taroify/taroify/pull/292) **Bug Fixes** - Picker - 修复当子元素(children)改变时,索引(index)未更新的问题 [#289](https://github.com/taroify/taroify/pull/289) ### v0.0.25-alpha.0 `2022-01-20` **New Component** - 新增 Avatar 组件 [#233](https://github.com/taroify/taroify/issues/233) [#248](https://github.com/taroify/taroify/pull/248) [@coderYarn](https://github.com/coderYarn) - 新增 AreaPicker 组件 [#77](https://github.com/taroify/taroify/issues/77) [#264](https://github.com/taroify/taroify/pull/272) [#264](https://github.com/taroify/taroify/pull/272) **Feature** - IndexList.Anchor - 新增全部属性 [#282](https://github.com/taroify/taroify/pull/282) [@bluescurry](https://github.com/bluescurry) - Picker - 新增 onChange 事件返回 column 对象 [#269](https://github.com/taroify/taroify/blob/1b80d78ed8bd0150b83c1485a3a5b692975ce7d9/packages/core/src/picker/picker-columns.tsx#L37) - SwipeCell - 优化微信小程序端的滑动动画效果 [#265](https://github.com/taroify/taroify/pull/265) **Bug Fixes** - Toast - 修复页面切换返回后不能打开的问题 [#283](https://github.com/taroify/taroify/issues/283) [#284](https://github.com/taroify/taroify/pull/284) - Notify - 修复页面切换返回后不能打开的问题 [#283](https://github.com/taroify/taroify/issues/283) [#284](https://github.com/taroify/taroify/pull/284) - Dialog - 修复页面切换返回后不能打开的问题 [#283](https://github.com/taroify/taroify/issues/283) [#284](https://github.com/taroify/taroify/pull/284) - Empty - 修复内部图片样式被覆盖的问题 [#268](https://github.com/taroify/taroify/issues/268) [#271](https://github.com/taroify/taroify/pull/271) ### v0.0.24-alpha.1 `2022-01-13` **Feature** - Form - 新增 onValuesChange 属性 [#258](https://github.com/taroify/taroify/issues/258) [#261](https://github.com/taroify/taroify/pull/261) **Bug Fixes** - Toast - 修复通过命令式调用重复打开的问题 [#259](https://github.com/taroify/taroify/issues/259) [#260](https://github.com/taroify/taroify/pull/260) - Notify - 修复通过命令式调用重复打开的问题 [#259](https://github.com/taroify/taroify/issues/259) [#260](https://github.com/taroify/taroify/pull/260) - Dialog - 修复通过命令式调用重复打开的问题 [#259](https://github.com/taroify/taroify/issues/259) [#260](https://github.com/taroify/taroify/pull/260) ### v0.0.24-alpha.0 `2022-01-12` **Feature** - Uploader - 新增 removable 属性 [#243](https://github.com/taroify/taroify/issues/243) [#256](https://github.com/taroify/taroify/pull/256) - Picker - 监听返回完整的选项(Option)对象 [#239](https://github.com/taroify/taroify/issues/239) [#242](https://github.com/taroify/taroify/pull/242) **Bug Fixes** - Style - 修复 multi-ellipsis 无法省略的问题 [#245](https://github.com/taroify/taroify/pull/245) - DatetimePicker - 修复设置 defaultValue 无效的问题 [#238](https://github.com/taroify/taroify/pull/238) [@Brain777777](https://github.com/Brain777777) - 修复 2 月存在 31 天的问题 [#240](https://github.com/taroify/taroify/issues/240) [#254](https://github.com/taroify/taroify/pull/254) ### v0.0.23-alpha.1 `2022-01-04` **Bug Fixes** - Field - 修复嵌套 Input 组件不能赋值 value 的问题 [#235](https://github.com/taroify/taroify/issues/235) ### v0.0.23-alpha.0 `2022-01-04` **New Component** - 新增 Space 组件 [#228](https://github.com/taroify/taroify/pull/228) [@coderYarn](https://github.com/coderYarn) **Feature** - ActionSheet.Action - 新增 value 属性 [#229](https://github.com/taroify/taroify/pull/229) [@coderYarn](https://github.com/coderYarn) **Bug Fixes** - Checkbox.Group - 修复设置 value 为空数组时,Checkbox 组件的 checked 不为 false 的问题 [#231](https://github.com/taroify/taroify/pull/231) ### v0.0.22-alpha.1 `2022-01-01` **Feature** - DatetimePicker - 新增 date-minute 类型(年月日时分) [#211](https://github.com/taroify/taroify/issues/211) [#227](https://github.com/taroify/taroify/pull/227) **Bug Fixes** - Input - 修复 readonly 状态下 placeholder 颜色为 --text-color-3 的问题 [#218](https://github.com/taroify/taroify/pull/218) ### v0.0.22-alpha.0 `2022-01-01` **New Component** - 新增 Form 组件 [#118](https://github.com/taroify/taroify/issues/118) [#224](https://github.com/taroify/taroify/pull/224) **Feature** - Cell - 设置 icon 和 rightIcon 属性时,仅为图标组件添加单元格图标样式 [#214](https://github.com/taroify/taroify/issues/214) [#225](https://github.com/taroify/taroify/pull/225) - Field - 新增 feedbackAlign 属性 [#224](https://github.com/taroify/taroify/pull/224) - 新增 feedbackStatus 属性 [#224](https://github.com/taroify/taroify/pull/224) - Search - 新增 inputColor 属性 [#224](https://github.com/taroify/taroify/pull/224) - 新增 feedbackAlign 属性 [#224](https://github.com/taroify/taroify/pull/224) - 新增 feedbackStatus 属性 [#224](https://github.com/taroify/taroify/pull/224) **Breaking Changes** - Field - 删除 Input 属性 [#224](https://github.com/taroify/taroify/pull/224) - 将 message 属性重命名为 feedback [#224](https://github.com/taroify/taroify/pull/224) - Search - 将 message 属性重命名为 feedback [#224](https://github.com/taroify/taroify/pull/224) **Bug Fixes** - Tabs - 修复 swipeable 不支持 lazyRender 的问题 [#218](https://github.com/taroify/taroify/pull/218) ### v0.0.21-alpha.1 `2021-12-22` **Feature** - Countdown - 新增单符号(D, H, m, s)格式 [#206](https://github.com/taroify/taroify/issues/206) [#208](https://github.com/taroify/taroify/pull/208) **Bug Fixes** - Countdown - 修复 value 无法更新的问题 [#205](https://github.com/taroify/taroify/issues/205) [#208](https://github.com/taroify/taroify/pull/208) - SafeArea - 修复 ios11 兼容性 constant(safe-area-inset-\*) 的问题 [#199](https://github.com/taroify/taroify/pull/199) [@Brain777777](https://github.com/Brain777777) ### v0.0.21-alpha.0 `2021-12-16` **New Component** - 新增 SafeArea 组件 [#195](https://github.com/taroify/taroify/pull/195) **Feature** - Badge - 新增 position 属性 [#196](https://github.com/taroify/taroify/pull/196) - Button - 新增 loading.size 属性 [#192](https://github.com/taroify/taroify/pull/192) [@zjwshisb](https://github.com/zjwshisb) - ShareSheet.Option - 新增 openType 属性 [#194](https://github.com/taroify/taroify/pull/194) [@kunkuntang](https://github.com/kunkuntang) **Bug Fixes** - Badge - 修复 content toString 的问题 [#196](https://github.com/taroify/taroify/pull/196) ### v0.0.20-alpha.5 `2021-12-15` **Bug Fixes** - DatetimePicker - 修复 clampDate 和 useValue 的问题 [#190](https://github.com/taroify/taroify/pull/190) ### v0.0.20-alpha.4 `2021-12-15` **Feature** - SwipeCell - 新增 defaultOpen 和 open 属性 [#172](https://github.com/taroify/taroify/issues/172) [#186](https://github.com/taroify/taroify/pull/186) **Bug Fixes** - Badge - 修复 content=\{0} 时,直接渲染 0 的问题 [#184](https://github.com/taroify/taroify/pull/184) [@zjwshisb](https://github.com/zjwshisb) - Field - 修复 H5 设置 inputAlign 为 right 无效的问题 [#182](https://github.com/taroify/taroify/pull/182) [@zjwshisb](https://github.com/zjwshisb) - Picker - 修复监听 onChange 事件为旧值的问题 [#189](https://github.com/taroify/taroify/pull/189) - DatetimePicker - 修复默认值为 undefined 的问题 [#188](https://github.com/taroify/taroify/pull/188) **Breaking Changes** - Countdown - 将 useCountDown() 和 CountDown 合并在一起 [#176](https://github.com/taroify/taroify/pull/176) [@Brain777777](https://github.com/Brain777777) - 将 CountDown 重命名为 Countdown [#179](https://github.com/taroify/taroify/pull/179) - 将 current 属性重命名为 value [#179](https://github.com/taroify/taroify/pull/179) - 将 millisecond 属性重命名为 interval=\{1} [#179](https://github.com/taroify/taroify/pull/179) - 将 onFinish 事件重命名为 onComplete [#179](https://github.com/taroify/taroify/pull/179) ### v0.0.20-alpha.3 `2021-12-11` **Feature** - Styles - 新增赋值 $hd 默认变量 [#173](https://github.com/taroify/taroify/issues/173) [#174](https://github.com/taroify/taroify/pull/174) ### v0.0.20-alpha.2 `2021-12-09` **Bug Fixes** - Pagination - 修复页码出现负数的问题 [#171](https://github.com/taroify/taroify/pull/171) [@zjwshisb](https://github.com/zjwshisb) ### v0.0.20-alpha.1 `2021-12-09` **Bug Fixes** - Dialog - 修复点击确认按钮导致自动关闭 [#170](https://github.com/taroify/taroify/issues/170) [#169](https://github.com/taroify/taroify/pull/169) ### v0.0.20-alpha.0 `2021-12-08` **Feature** - Popup - 新增 defaultOpen 属性 [#86](https://github.com/taroify/taroify/issues/86) [#165](https://github.com/taroify/taroify/pull/165) - Toast - 新增 defaultOpen 属性 [#86](https://github.com/taroify/taroify/issues/86) [#165](https://github.com/taroify/taroify/pull/165) - Cascader - 新增 defaultValue 属性 [#86](https://github.com/taroify/taroify/issues/86) [#165](https://github.com/taroify/taroify/pull/165) - Calendar - 新增 defaultValue 属性 [#86](https://github.com/taroify/taroify/issues/86) [#165](https://github.com/taroify/taroify/pull/165) - Checkbox - 新增 defaultChecked 属性 [#86](https://github.com/taroify/taroify/issues/86) [#165](https://github.com/taroify/taroify/pull/165) - DatetimePicker - 新增 defaultValue 属性 [#86](https://github.com/taroify/taroify/issues/86) [#165](https://github.com/taroify/taroify/pull/165) - Picker - 新增 defaultValue 属性 [#86](https://github.com/taroify/taroify/issues/86) [#165](https://github.com/taroify/taroify/pull/165) - Radio - 新增 defaultChecked 属性 [#86](https://github.com/taroify/taroify/issues/86) [#165](https://github.com/taroify/taroify/pull/165) - Rate - 新增 defaultValue 属性 [#86](https://github.com/taroify/taroify/issues/86) [#165](https://github.com/taroify/taroify/pull/165) - Slider - 新增 defaultValue 属性 [#86](https://github.com/taroify/taroify/issues/86) [#165](https://github.com/taroify/taroify/pull/165) - Stepper - 新增 defaultValue 属性 [#86](https://github.com/taroify/taroify/issues/86) [#165](https://github.com/taroify/taroify/pull/165) - Switch - 新增 defaultChecked 属性 [#86](https://github.com/taroify/taroify/issues/86) [#165](https://github.com/taroify/taroify/pull/165) - Uploader - 新增 defaultValue 属性 [#86](https://github.com/taroify/taroify/issues/86) [#165](https://github.com/taroify/taroify/pull/165) - ActionSheet - 新增 defaultOpen 属性 [#86](https://github.com/taroify/taroify/issues/86) [#165](https://github.com/taroify/taroify/pull/165) - Dialog - 新增 defaultOpen 属性 [#86](https://github.com/taroify/taroify/issues/86) [#165](https://github.com/taroify/taroify/pull/165) - DropdownMenu - 新增 defaultValue 属性 [#86](https://github.com/taroify/taroify/issues/86) [#165](https://github.com/taroify/taroify/pull/165) - Notify - 新增 defaultOpen 属性 [#86](https://github.com/taroify/taroify/issues/86) [#165](https://github.com/taroify/taroify/pull/165) - Backdrop - 新增 defaultOpen 属性 [#86](https://github.com/taroify/taroify/issues/86) [#165](https://github.com/taroify/taroify/pull/165) - ShareSheet - 新增 defaultOpen 属性 [#86](https://github.com/taroify/taroify/issues/86) [#165](https://github.com/taroify/taroify/pull/165) - Collapse - 新增 defaultValue 属性 [#86](https://github.com/taroify/taroify/issues/86) [#165](https://github.com/taroify/taroify/pull/165) - Collapse - 新增 defaultValue 属性 [#86](https://github.com/taroify/taroify/issues/86) [#165](https://github.com/taroify/taroify/pull/165) - Steps - 新增 defaultValue 属性 [#86](https://github.com/taroify/taroify/issues/86) [#165](https://github.com/taroify/taroify/pull/165) - Swiper - 新增 defaultValue 属性 [#86](https://github.com/taroify/taroify/issues/86) [#165](https://github.com/taroify/taroify/pull/165) - Sidebar - 新增 defaultValue 属性 [#86](https://github.com/taroify/taroify/issues/86) [#165](https://github.com/taroify/taroify/pull/165) - Tabs - 新增 defaultValue 属性 [#86](https://github.com/taroify/taroify/issues/86) [#165](https://github.com/taroify/taroify/pull/165) - Tabbar - 新增 defaultValue 属性 [#86](https://github.com/taroify/taroify/issues/86) [#165](https://github.com/taroify/taroify/pull/165) - TreeSelect - 新增 defaultValue 属性 [#86](https://github.com/taroify/taroify/issues/86) [#165](https://github.com/taroify/taroify/pull/165) ### v0.0.19-alpha.3 `2021-12-04` **Feature** - NavBar - 新增 fixed & placeholder 属性 [#159](https://github.com/taroify/taroify/pull/159) **Bug Fixes** - multi-ellipsis - 修复多行文本不省略的问题 [#160](https://github.com/taroify/taroify/pull/160) ### v0.0.19-alpha.2 `2021-12-03` **Bug Fixes** - PullRefresh - 修复嵌套在 CustomWrapper 中不能触发 onRefresh 的问题 [#156](https://github.com/taroify/taroify/pull/156) - NumberKeyboard - 修复 Transition 组件未嵌套在真实元素上,而不能隐藏的的问题 [#154](https://github.com/taroify/taroify/pull/154) **Breaking Changes** - PasswordInput - 将 focused 属性重命名为 focus 属性 [#155](https://github.com/taroify/taroify/pull/155) ### v0.0.19-alpha.1 `2021-12-02` **Feature** - Transition - 新增 appear 、mountOnEnter 属性 [#148](https://github.com/taroify/taroify/pull/148) **Bug Fixes** - createNodesRef - 修复获得嵌套在 CustomWrapper 内的 NodesRef 为 undefined 的问题 [#143](https://github.com/taroify/taroify/pull/143) [@wowhy](https://github.com/wowhy) - Circle - 修复重复获得 CanvasContext 导致无法初始化渲染的问题 [#145](https://github.com/taroify/taroify/issues/145) [#146](https://github.com/taroify/taroify/issues/146) - Uploader - 修复在多选(multiple)模式下,不能显示上传的本地图片的问题 [#152](https://github.com/taroify/taroify/issues/152) [#151](https://github.com/taroify/taroify/pull/151) **Performance** - Backdrop - 使用 Transition 组件代替 css transition [#150](https://github.com/taroify/taroify/issues/150) [#149](https://github.com/taroify/taroify/issues/149) ### v0.0.19-alpha.0 `2021-11-26` **Refactor** - Swiper - 重构 Swiper 组件,增加 value 属性 [#120](https://github.com/taroify/taroify/issues/120) [#137](https://github.com/taroify/taroify/pull/137) **Bug Fixes** - Circle - 修复在低版本的小程序中不渲染的问题 [#139](https://github.com/taroify/taroify/issues/139) [#140](https://github.com/taroify/taroify/pull/140) ### v0.0.18-alpha.9 `2021-11-22` **Feature** - Icons - 修复在采用导入全部样式的方式时,存在图标样式被覆盖的问题 [#134](https://github.com/taroify/taroify/issues/134) [#135](https://github.com/taroify/taroify/issues/135) ### v0.0.18-alpha.8 `2021-11-19` **Feature** - Empty - 新增 children 属性 [#131](https://github.com/taroify/taroify/issues/131) [#132](https://github.com/taroify/taroify/pull/132) ### v0.0.18-alpha.7 `2021-11-19` ### v0.0.18-alpha.6 `2021-11-19` **Bug Fixes** - PullRefresh - 修复在小程序中 overflow 超出 100% 时,不能滚动下拉的问题 [#129](https://github.com/taroify/taroify/issues/129) [#130](https://github.com/taroify/taroify/issues/130) ### v0.0.18-alpha.5 `2021-11-17` **Bug Fixes** - Circle - 修复在 useReady 里获得 CanvasNode 为 undefined 的问题 [#127](https://github.com/taroify/taroify/issues/127) [#128](https://github.com/taroify/taroify/issues/128) ### v0.0.18-alpha.4 `2021-11-17` **Bug Fixes** - Field - 修复 calc(var(--padding-xs, #\{$padding-xs}) \* -1) 的问题 [#121](https://github.com/taroify/taroify/issues/121) [#126](https://github.com/taroify/taroify/issues/126) - TreeSelect - 修复 calc(var(--padding-xs, #\{$padding-xs}) \* -1) 的问题 [#122](https://github.com/taroify/taroify/issues/122) [#124](https://github.com/taroify/taroify/issues/124) - Slider - 修复 calc(var(--padding-xs, #\{$padding-xs}) \* -1) 的问题 [#123](https://github.com/taroify/taroify/issues/123) [#125](https://github.com/taroify/taroify/issues/125) ### v0.0.18-alpha.3 `2021-11-15` **Feature** - Uploader - 补全 Uploader.Image 属性 [#113](https://github.com/taroify/taroify/issues/113) [#117](https://github.com/taroify/taroify/pull/117) - Icons - 补全 Icons 属性 [#113](https://github.com/taroify/taroify/issues/113) [#115](https://github.com/taroify/taroify/pull/115) **Bug Fixes** - List - 修复重复执行 onLoad 事件的问题 [#112](https://github.com/taroify/taroify/issues/112) [#116](https://github.com/taroify/taroify/pull/116) ### v0.0.18-alpha.2 `2021-11-14` **Performance** - 优化 Demo 示例项目打包体积 [#83](https://github.com/taroify/taroify/pull/83) [@Ace Han](https://github.com/ace-han) **Bug Fixes** - Flex - 修复 Flex.Item 缺少 children 属性的问题 [#110](https://github.com/taroify/taroify/issues/110) [#111](https://github.com/taroify/taroify/pull/111) ### v0.0.18-alpha.1 `2021-11-14` **Feature** - 新增 @taroify/hooks 包 [#109](https://github.com/taroify/taroify/issues/109) ### v0.0.18-alpha.0 `2021-11-14` **New Component** - 新增 Cascader 组件 [#96](https://github.com/taroify/taroify/issues/96) [#106](https://github.com/taroify/taroify/pull/106) **Bug Fixes** - Transition - 修复设置 in 属性默认为 true 时不执行动画的问题 [#100](https://github.com/taroify/taroify/issues/100) [#101](https://github.com/taroify/taroify/issues/101) - Field - 修复 maxlength 默认为 -1 时,导致数字或整数无法输入的问题 [#99](https://github.com/taroify/taroify/issues/99) [#102](https://github.com/taroify/taroify/issues/102) [#105](https://github.com/taroify/taroify/pull/105) **Breaking Changes** - Flex - 将 Row & Col 合并成 Flex 组件 [#103](https://github.com/taroify/taroify/issues/103) [#104](https://github.com/taroify/taroify/pull/104) ### v0.0.17-alpha.4 `2021-11-11` **Bug Fixes** - Sticky - 删除多余的 `console.log()` 打印 [#97](https://github.com/taroify/taroify/issues/97) [#98](https://github.com/taroify/taroify/pull/98) ### v0.0.17-alpha.3 `2021-11-11` **Bug Fixes** - Dialog - 修复在未按需加载内部使用 Button 组件样式的问题 [#90](https://github.com/taroify/taroify/issues/90) [#93](https://github.com/taroify/taroify/pull/93) - Collapse - 修复因继承自 StandardProps 接口,而导致 value 为 undefined 的问题 [#89](https://github.com/taroify/taroify/issues/89) [#94](https://github.com/taroify/taroify/pull/94) **Breaking Changes** - PullRefresh - 将判断 reachTop 的逻辑移动到组件外部 [#92](https://github.com/taroify/taroify/issues/92) [#95](https://github.com/taroify/taroify/pull/95) ### v0.0.17-alpha.2 `2021-11-05` **Feature** - Toast - 新增命令式调用 `Toast.close()`、`Toast.setDefaultOptions()`、`Toast.resetDefaultOptions()` 方法 [#78](https://github.com/taroify/taroify/issues/78) - Notify - 新增命令式调用 `Notify.close()`、`Notify.setDefaultOptions()`、`Notify.resetDefaultOptions()` 方法 [#71](https://github.com/taroify/taroify/issues/71) - Dialog - 新增命令式调用 `Dialog.close()`、`Dialog.setDefaultOptions()`、`Dialog.resetDefaultOptions()` 方法 [#71](https://github.com/taroify/taroify/issues/71) **Bug Fixes** - Image - 修复因 `display: none` 导致重复加载的问题 [#79](https://github.com/taroify/taroify/pull/79) [@Pingren](https://github.com/Pingren) - ShareSheet - 修复 ShareSheet.Option 在小程序上存在垂直展示的问题 [#82](https://github.com/taroify/taroify/issues/82) - PullRefresh - 修复在小程序真机下拉刷新时存在卡帧的问题 [#74](https://github.com/taroify/taroify/issues/74) ### v0.0.17-alpha.1 `2021-11-04` **Bug Fixes** - Stepper - 修复第一次点击无反应的问题 [#76](https://github.com/taroify/taroify/issues/76) ### v0.0.17-alpha.0 `2021-11-03` **Feature** - Search - 新增 focus 属性 [#73](https://github.com/taroify/taroify/issues/73) - Toast - 新增命令式调用 `Toast.open()`、`Toast.loading()`、`Toast.success()`、`Toast.fail()` 方法 [#71](https://github.com/taroify/taroify/issues/71) [#69](https://github.com/taroify/taroify/issues/69) - Notify - 新增命令式调用 `Notify.open()` 方法 [#71](https://github.com/taroify/taroify/issues/71) [#69](https://github.com/taroify/taroify/issues/69) - Dialog - 新增命令式调用 `Dialog.open()`、`Dialog.alert()`、`Dialog.confirm()` 方法 [#71](https://github.com/taroify/taroify/issues/71) [#69](https://github.com/taroify/taroify/issues/69) **Bug Fixes** - DatetimePicker - 修复在改变 value 导致缺少 columns 的问题 [#75](https://github.com/taroify/taroify/issues/75) - Popup - 修复在编译打包后因背景板(Backdrop)叠加显示在依赖 Popup 组件之上的问题 [#72](https://github.com/taroify/taroify/issues/72) - Search - 修复设置 autoFocus 属性无效的问题 [#73](https://github.com/taroify/taroify/issues/73) ### v0.0.16-alpha.3 `2021-11-01` **Bug Fixes** - List - 修复因 children 改变未触发 onLoad 事件的问题 [#70](https://github.com/taroify/taroify/issues/70) ### v0.0.16-alpha.2 `2021-11-01` **Bug Fixes** - Sticky - 修复因 offsetTop, offsetBottom 未显示解构而导致的设置属性错误的问题 [#68](https://github.com/taroify/taroify/issues/68) ### v0.0.16-alpha.1 `2021-11-01` **Bug Fixes** - 修复`@taroify/icons`样式问题 [#67](https://github.com/taroify/taroify/issues/67) ### v0.0.16-alpha.0 `2021-10-31` **New Component** - 新增 Calendar 组件 [#66](https://github.com/taroify/taroify/issues/66) **Feature** - 提供完全属性集,为所有组件的属性继承自 StandardProps 接口 [#65](https://github.com/taroify/taroify/issues/65) - 使用 useMounted 代替 useReady 钩子 [#62](https://github.com/taroify/taroify/issues/62) - @taroify/icons 增强自动导入图标样式 [#63](https://github.com/taroify/taroify/issues/63) ### v0.0.15-alpha.12 `2021-10-26` **Breaking Changes** - Cell.Group - title 属性的类型调整为 ReactNode [#60](https://github.com/taroify/taroify/issues/60) ### v0.0.15-alpha.11 `2021-10-25` **Bug Fixes** - Popup - 修复导入`@taroify/~icons`的问题 [#59](https://github.com/taroify/taroify/issues/59) ### v0.0.15-alpha.10 `2021-10-25` **Feature** - Tabs - 新增 TabsSticky 属性,用以设置 Tabs.sticky 属性 [#58](https://github.com/taroify/taroify/issues/58) **Breaking Changes** - Sticky - 使用 offsetTop, offsetBottom 属性代替 \{ top, bottom } 属性 [#57](https://github.com/taroify/taroify/issues/57) ### v0.0.15-alpha.9 `2021-10-25` **Bug Fixes** - Button - 修复文本按钮存在边框的问题 [#55](https://github.com/taroify/taroify/issues/55) **Breaking Changes** - Button - 删除 color 自定义属性,使用 CSS className 和 style 代替 color 属性 [#56](https://github.com/taroify/taroify/issues/56) ### v0.0.15-alpha.8 `2021-10-24` **Feature** - Sticky - 新增 onScroll 事件 [#51](https://github.com/taroify/taroify/issues/51) - Image - 新增 onClick 事件 [#54](https://github.com/taroify/taroify/issues/54) **Bug Fixes** - Tabs - 修复设置 sticky 无法切换 Tab 的问题 [#52](https://github.com/taroify/taroify/issues/52) - Styles - 修复 tap-highlight-color 默认为淡蓝的问题 [#54](https://github.com/taroify/taroify/issues/53) ### v0.0.15-alpha.7 `2021-10-22` **Feature** - 使用 esm 作为默认打包方式 [#50](https://github.com/taroify/taroify/issues/50) ### v0.0.15-alpha.6 `2021-10-22` **Feature** - Toast - 新增 position 属性 [#49](https://github.com/taroify/taroify/issues/49) ### v0.0.15-alpha.5 `2021-10-22` **Bug Fixes** - Transition - 修复 DOM 在 enter 之前已挂载的问题 [#48](https://github.com/taroify/taroify/issues/48) ### v0.0.15-alpha.4 `2021-10-21` **Feature** - Tag - 新增 onClick 事件 [#46](https://github.com/taroify/taroify/issues/46) **Breaking Changes** - Tag - 删除 textColor 属性,使用 CSS className 和 style 代替 textColor 属性 [#47](https://github.com/taroify/taroify/issues/47) ### v0.0.15-alpha.3 `2021-10-20` **Feature** - Uploader.Image - 新增 mode, alt, round 属性 [#45](https://github.com/taroify/taroify/issues/45) ### v0.0.15-alpha.2 `2021-10-19` **Bug Fixes** - Transition - 修复因设置 unmountOnExit 属性,而导致小程序渲染错乱的问题 [#42](https://github.com/taroify/taroify/issues/42) ### v0.0.15-alpha.1 `2021-10-18` **Feature** - Tabs - 新增 bottomBar 的 css 变量 [#40](https://github.com/taroify/taroify/issues/40) ### v0.0.15-alpha.0 `2021-10-16` **New Component** - 新增 ConfigProvider 组件 [#39](https://github.com/taroify/taroify/issues/39) ### v0.0.14-alpha.2 `2021-10-13` **Bug Fixes** - SwipeCell - 修复动画卡顿和 rightRect 为空的问题 [#37](https://github.com/taroify/taroify/issues/37) ### v0.0.14-alpha.1 `2021-10-11` **Bug Fixes** - Tabbar - 修复图标为空时,Badge 组件未清理的问题 [#35](https://github.com/taroify/taroify/issues/35) ### v0.0.14-alpha.0 `2021-10-11` **Breaking Changes** - DropdownMenu - activeKey 属性重命名为 value [#34](https://github.com/taroify/taroify/issues/34) - Collapse - activeKey 属性重命名为 value [#34](https://github.com/taroify/taroify/issues/34) - Sidebar - activeKey 属性重命名为 value [#34](https://github.com/taroify/taroify/issues/34) - TreeSelect - activeTab 属性重命名为 tabValue [#34](https://github.com/taroify/taroify/issues/34) - activeValue 属性重命名为 value [#34](https://github.com/taroify/taroify/issues/34) ### v0.0.13-alpha.0 `2021-10-09` **Feature** - 完善 css var 自定义主题 [#23](https://github.com/taroify/taroify/issues/23) - 新增所有的 vant 图标 [#30](https://github.com/taroify/taroify/issues/30) ### v0.0.12-alpha.18 `2021-09-30` **Bug Fixes** - Button - 修复细边框样式模糊问题 [#29](https://github.com/taroify/taroify/issues/29) ### v0.0.12-alpha.17 `2021-09-27` **Bug Fixes** - Tabs - 修复滑动切换时 Tab 没有效果的问题 [#28](https://github.com/taroify/taroify/issues/28) ### v0.0.12-alpha.16 `2021-09-27` **Feature** - Tabs.TabPane - 新增 value 属性 [#26](https://github.com/taroify/taroify/issues/26) **Bug Fixes** - Button - 修复 disabled 为 true 时,依然可以点击的问题 [#27](https://github.com/taroify/taroify/issues/27) **Breaking Changes** - Tabs - activeKey 属性重命名为 value [#26](https://github.com/taroify/taroify/issues/26) ### v0.0.12-alpha.15 `2021-09-27` **Bug Fixes** - Tabs - 修复在微信小程序获得 navRect 为空的问题 [#19](https://github.com/taroify/taroify/pull/19) ### v0.0.12-alpha.14 `2021-09-26` **Feature** - @taroify/icons - 在使用 @taroify/core 组件时,自动导入图标样式 [#24](https://github.com/taroify/taroify/issues/24) ### v0.0.12-alpha.13 `2021-09-26` **Bug Fixes** - NoticeBar - 修复动态渲染时,useReady 不执行的问题 [#20](https://github.com/taroify/taroify/pull/20) ### v0.0.12-alpha.12 `2021-09-23` **Bug Fixes** - Sheet - 修复按需导入样式的问题 [#18](https://github.com/taroify/taroify/issues/18) - Tabs - 修复 navOffset 为 null 导致报错的问题 [#17](https://github.com/taroify/taroify/pull/17) ### v0.0.12-alpha.11 `2021-09-23` **Bug Fixes** - Divider - 修复 className 放置错误问题 [#16](https://github.com/taroify/taroify/pull/16) ### v0.0.12-alpha.10 `2021-09-22` **Feature** - 所有组件新增 className 属性 [#15](https://github.com/taroify/taroify/issues/15) ### v0.0.12-alpha.9 `2021-09-22` ### v0.0.12-alpha.8 `2021-09-22` **Feature** - Field - 新增 name 属性 [#11](https://github.com/taroify/taroify/issues/11) **Bug Fixes** - Import on demand - 修复重复导入样式的问题 [#13](https://github.com/taroify/taroify/issues/13) - NoticeBar - 修复 NoticeBar 全局样式引入问题 [#14](https://github.com/taroify/taroify/issues/14) ### v0.0.12-alpha.7 `2021-09-09` ### v0.0.12-alpha.6 `2021-09-09` **Bug Fixes** - NumberKeyboard - 修复 classNames 导入方式不正确的问题 [#10](https://github.com/taroify/taroify/issues/10) ### v0.0.12-alpha.5 `2021-09-08` **Feature** - Navbar - title 提升为 ReactNode 类型 [#7](https://github.com/taroify/taroify/issues/7) - Sticky - 新增 onChange 事件 [#6](https://github.com/taroify/taroify/issues/6) **Breaking Change** - Tabbar - 重命名 Tabbar.Item 为 Tabbar.TabItem [#8](https://github.com/taroify/taroify/issues/8) ### v0.0.12-alpha.4 `2021-09-04` **Feature** - Button - 新增小程序属性 [#2](https://github.com/taroify/taroify/issues/2) - Tabbar - 新增 fixed 属性 [#5](https://github.com/taroify/taroify/issues/5) - Tabbar:新增 placeholder 属性 [#5](https://github.com/taroify/taroify/issues/5) - Tabbar:新增 bordered 属性 [#5](https://github.com/taroify/taroify/issues/5) - Tabbar.Item:新增 badge 属性 [#5](https://github.com/taroify/taroify/issues/5) ### v0.0.12-alpha.3 `2021-09-03` ### v0.0.12-alpha.2 `2021-09-03` **Bug Fixes** - List:修复 nextTick 在微信小程序不执行的问题 [#3](https://github.com/taroify/taroify/issues/3) ### v0.0.12-alpha.1 `2021-08-31` **Feature** - Search:新增 icon 属性 - Navbar:新增 NavLeft onClick 事件 - Navbar:新增 NavRight onClick 事件 - Navbar:使用 NavLeft.children 代替 NavLeft.text - Navbar:使用 NavRight.children 代替 NavRight.text **Bug Fixes** - Tabs:修复 设置 sticky 时 container 为 undefined 的问题 ### v0.0.12-alpha.0 `2021-08-25` **New Component** - 新增 Field 组件 - 新增 Search 组件 **Feature** - Cell.Group: 新增 inset 属性 ### v0.0.11-alpha.0 `2021-08-18` **New Component** - 新增 NumberKeyboard 组件 - 新增 Uploader 组件 **Feature** - Tabs: 新增 animated 属性 - Tabs: 新增 swipeable 属性 ### v0.0.10-alpha.0 `2021-07-30` **New Component** - 新增 Checkbox 组件 - 新增 Radio 组件 - 新增 PasswordInput 组件 ### v0.0.9-alpha.0 `2021-07-26` **New Component** - 新增 Rate 组件 - 新增 Slider 组件 ### v0.0.8-alpha.0 `2021-07-22` **New Component** - 新增 Stepper 组件 - 新增 Switch 组件 ### v0.0.7-alpha.0 `2021-07-21` **New Component** - 新增 DropdownMenu 组件 - 新增 PullRefresh 组件 - 新增 Circle 组件 - 新增 List 组件 - 新增 IndexList 组件 ### v0.0.6-alpha.0 `2021-06-21` **New Component** - 新增 SwipeCell 组件 - 新增 Collapse 组件 - 新增 CountDown 组件 - 新增 NoticeBar 组件 - 新增 Skeleton 组件 - 新增 Steps 组件 - 新增 TreeSelect 组件 ### v0.0.5-alpha.0 `2021-05-21` **New Component** - 新增 Notify 组件 - 新增 Progress 组件 - 新增 Sticky 组件 - 新增 Swiper 组件 - 新增 Pagination 组件 **Breaking Changes** - Cell:重命名 subtitle 属性为 brief - Toast:重命名 placement 属性为 position ### v0.0.4-alpha.0 `2021-05-07` **New Component** - 新增 ActionSheet 组件 - 新增 Dialog 组件 - 新增 ShareSheet 组件 **Breaking Changes** - Cell.Group:重命名 CellGroup 组件为 Cell.Group - Popup:去除 backdrop 属性,将 backdrop 属性设计为 Popup.Backdrop 组件 **Bug Fixes** - Popup:修复点击关闭图标无反应的问题 ### v0.0.3-alpha.0 `2021-04-30` **New Component** - 新增 Badge 组件 - 新增 Tag 组件 - 新增 Grid 组件 - 新增 Navbar 组件 - 新增 Sidebar 组件 - 新增 Tabs 组件 - 新增 Tabbar 组件 **Breaking Changes** - Cell:label 属性重命名为 title - Cell:description 属性重命名为 subtitle **Bug Fixes** - 修复使用 babel-plugin-import 无法导入依赖组件样式问题 ### v0.0.1-alpha.0 `2021-04-19` **New Component** - 新增 Backdrop 组件 - 新增 Button 组件 - 新增 Cell 组件 - 新增 CellGroup 组件 - 新增 Col 组件 - 新增 Image 组件 - 新增 Loading 组件 - 新增 Popup 组件 - 新增 Row 组件 - 新增 Toast 组件 - 新增 Transition 组件 --- url: https://taroify.com/components/button/index.md --- # Button 按钮 ### 介绍 按钮用于触发一个操作,如提交表单。 ### 引入 ```jsx import { Button } from "@taroify/core" ``` ## 代码演示 ### 按钮颜色 按钮支持 `default`、`primary`、`info`、`success`、`warning`、`danger` 六种颜色,默认为 `default`。 ```jsx ``` ### 文本按钮 通过 `variant="text"` 属性将按钮设置为文本按钮。 ```jsx ``` ### 轮廓按钮 通过 `variant="outlined"` 属性将按钮设置为轮廓按钮。 ```jsx ``` ### 细边框 设置 `hairline` 属性可以展示 0.5px 的细边框。 ```jsx ``` ### 禁用状态 通过 `disabled` 属性来禁用按钮,禁用状态下按钮不可点击。 ```jsx ``` ### 加载状态 通过 `loading` 属性设置按钮为加载状态,可以通过 `{ type: "spinner" }` 设置加载类型。加载时会隐藏 `icon` 属性传入的业务图标;通过 `loadingText` 可以单独设置加载文案,不传时保留原按钮内容。 ```tsx ``` ### 按钮形状 通过 `shape="square"` 设置方形按钮,通过 `shape="round"` 设置圆形按钮。 ```jsx ``` ### 图标按钮 通过 `icon` 属性设置按钮图标,支持任意 React 节点。仅包含图标的按钮应通过 `ariaLabel` 提供用于无障碍阅读的名称。 ```jsx ``` ### 无障碍阅读 `ariaLabel` 用于为屏幕阅读器等辅助工具提供按钮名称,不会改变按钮的视觉效果。普通文本按钮会尝试从内容中自动提取名称;图标按钮没有可提取的文字,应显式设置 `ariaLabel`。 ```jsx ``` `Button.Group` 默认声明为 `group` 语义,帮助屏幕阅读器识别一组相关操作。具体支持情况取决于目标 Taro 平台。 ### 按钮尺寸 支持 `large`、`medium`、`small`、`mini` 四种尺寸,默认为 `medium`。 ```jsx ``` ### 块级元素 按钮在默认情况下为行内块级元素,通过 `block` 属性可以将按钮的元素类型设置为块级元素。 ```jsx ``` ### 自定义颜色 通过 `color` 属性可以自定义按钮颜色。渐变色适用于 `contained` 按钮。 ```tsx ``` ### 微信开放能力 Button 继承了 Taro 原生 Button 的属性,可以通过 `openType` 使用微信小程序开放能力。JSX 中需要使用驼峰写法,例如原生小程序的 `open-type`、`bindgetphonenumber` 分别写为 `openType`、`onGetPhoneNumber`。 ```tsx ``` 开放能力的可用范围、参数和回调由目标小程序平台决定,H5 等不支持对应能力的平台不会生效,具体请参考 [Taro Button 文档](https://docs.taro.zone/docs/components/forms/button)。 ### 按钮组 ```tsx ``` ## API ### Props | 参数 | 说明 | 类型 | 默认值 | | -------------------------------- | ------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------- | ----------- | | variant | 按钮变种,可选值为 `contained` `text` `outlined` | _string_ | `contained` | | color | 预设颜色或任意 CSS 颜色,预设值为 `default` `primary` `info` `success` `warning` `danger` | _string_ | `default` | | size | 尺寸,可选值为 `large` `small` `mini` | _string_ | `medium` | | shape | 按钮形状,可选值为 `square` `round` | _string_ | - | | icon | 按钮图标 | _ReactNode_ | - | | iconPosition | 图标展示位置,可选值为 `right` | _string_ | `left` | | formType | 原生 button 标签的 type 属性 | _string_ | `button` | | block | 是否为块级元素 | _boolean_ | `false` | | disabled | 是否禁用按钮 | _boolean_ | `false` | | hairline | 是否使用 0.5px 边框 | _boolean_ | `false` | | loading | 是否显示为加载状态或自定义加载图标 | _boolean \| [LoadingProps](/components/loading/index.md#props) \| ReactElement_ | `false` | | loadingText | 加载状态文案 | _ReactNode_ | - | | ariaLabel | 用于无障碍阅读的按钮名称,图标按钮建议显式设置 | _string_ | 自动从内容提取 | | openType | 小程序开放能力,取值和相关事件请参考 [Taro Button](https://docs.taro.zone/docs/components/forms/button) | _string_ | - | | children | 按钮内容 | _ReactNode_ | - | 除上述属性外,Button 还支持 Taro 原生 Button 的开放能力参数及事件,例如 `onGetPhoneNumber`、`onContact`、`onChooseAvatar` 和 `onOpenSetting`。 ### Button.Group Props | 参数 | 说明 | 类型 | 默认值 | | ------------------------------ | --------------------------------------- | --------- | ----------- | | variant | 按钮变种,可选值为 `contained` `text` `outlined` | _string_ | `contained` | | color | 预设颜色或任意 CSS 颜色 | _string_ | `default` | | size | 尺寸,可选值为 `large` `small` `mini` | _string_ | `medium` | | shape | 按钮形状,可选值为 `round` | _string_ | - | | block | 是否为块级元素 | _boolean_ | - | | disabled | 是否禁用按钮 | _boolean_ | - | | hairline | 是否使用 0.5px 边框 | _boolean_ | - | | ariaLabel | 用于无障碍阅读的按钮组名称 | _string_ | - | | role | 用于无障碍阅读的按钮组语义角色 | _string_ | `group` | ## 主题定制 ### 样式变量 组件提供了下列 CSS 变量,可用于自定义样式,使用方法请参考 [ConfigProvider](/components/config-provider/index.md) 组件。 | 名称 | 默认值 | 描述 | | ---------------------------------------------------------- | ---------------------------------------- | -- | | --button-line-height | _1.2_ | - | | --button-border-width | _var(--border-width-base)_ | - | | --button-border-radius | _var(--border-radius-sm)_ | - | | --button-border-radius-max | _var(--border-radius-max)_ | - | | --button-transition-duration | _var(--animation-duration-fast)_ | - | | --button-active-opacity | _0.1_ | - | | --button-disabled-opacity | _var(--disabled-opacity)_ | - | | --button-outlined-background-color | _var(--background-color-2)_ | - | | --button-focus-visible-outline | _2px \* $hd solid var(--primary-color)_ | - | | --button-focus-visible-outline-offset | _2px \* $hd_ | - | | --button-icon-size | _1.2em_ | - | | --button-content-gap | _var(--padding-base)_ | - | | --button-loading-icon-size | _20px \* $hd_ | - | | --button-height-mini | _24px \* $hd_ | - | | --button-padding-mini | _0 var(--padding-base)_ | - | | --button-font-size-mini | _var(--font-size-xs)_ | - | | --button-height-small | _32px \* $hd_ | - | | --button-padding-small | _0 var(--padding-xs)_ | - | | --button-font-size-small | _var(--font-size-sm)_ | - | | --button-height-medium | _44px \* $hd_ | - | | --button-padding-medium | _0 var(--padding-md)_ | - | | --button-font-size-medium | _var(--font-size-md)_ | - | | --button-height-large | _50px \* $hd_ | - | | --button-font-size-large | _var(--font-size-lg)_ | - | | --button-default-color | _var(--text-color)_ | - | | --button-default-background-color | _var(--background-color-2)_ | - | | --button-default-border-color | _var(--border-color)_ | - | | --button-primary-color | _var(--white)_ | - | | --button-primary-background-color | _var(--primary-color)_ | - | | --button-primary-border-color | _var(--button-primary-background-color)_ | - | | --button-info-color | _var(--white)_ | - | | --button-info-background-color | _var(--info-color)_ | - | | --button-info-border-color | _var(--button-info-background-color)_ | - | | --button-success-color | _var(--white)_ | - | | --button-success-background-color | _var(--success-color)_ | - | | --button-success-border-color | _var(--button-success-background-color)_ | - | | --button-warning-color | _var(--white)_ | - | | --button-warning-background-color | _var(--warning-color)_ | - | | --button-warning-border-color | _var(--button-warning-background-color)_ | - | | --button-danger-color | _var(--white)_ | - | | --button-danger-background-color | _var(--danger-color)_ | - | | --button-danger-border-color | _var(--button-danger-background-color)_ | - | --- url: https://taroify.com/components/cell/index.md --- # Cell 单元格 ### 介绍 单元格为列表中的单个展示项。 ### 引入 ```tsx import { Cell } from "@taroify/core" ``` ## 代码演示 ### 基础用法 `Cell` 可以单独使用,也可以与 `Cell.Group` 搭配使用,`Cell.Group` 可以为 `Cell` 提供上下外边框。 ```tsx 内容 内容 ``` ### 卡片风格 通过 `Cell.Group` 的 `inset` 属性,可以将单元格转换为圆角卡片风格。卡片模式不会显示上下外边框。 ```tsx 内容 内容 ``` ### 单元格大小 通过 `size` 属性可以控制单元格的大小。 ```tsx 内容 内容 ``` ### 展示图标 通过 `icon` 属性在标题左侧展示图标。 ```tsx } title="单元格"> 内容 ``` ### 只设置内容 只设置 `children` 时,内容会靠左对齐。 ```tsx 内容 ``` ### 展示箭头 设置 `isLink` 属性后会在单元格右侧展示箭头,并且可以通过 `arrowDirection` 控制箭头方向。 ```tsx ``` ### 页面导航 v1.0.1 使用 `Cell.Link` 可以通过 Taro `Navigator` 完成页面跳转。`Cell.Link` 默认展示右侧箭头并开启点击反馈。 ```tsx 查看 ``` ### 额外内容 v1.0.1 通过 `extra` 属性可以在右侧图标之后放置额外内容。 ```tsx }> 已开启 ``` ### 分组标题 通过 `Cell.Group` 的 `title` 属性可以指定分组标题。 ```tsx 内容 内容 ``` ### 对齐方式 通过 `align` 属性可以改变 `Cell` 的左右内容的对齐方式。 ```tsx 内容 内容 内容 ``` ## 升级提示 - `Cell.Group` 的标题和内容容器现在是同级节点,传入的原生 View 属性会作用于内容容器。 - `Cell.Group` 在 `inset` 模式下不再显示上下外边框。 - `Cell` 显式设置的 `clickable` 优先于 `isLink` 和 `Cell.Group clickable`。 - `icon` 和 `rightIcon` 会被统一的布局节点包裹,自定义图标会自动获得标准间距和对齐。 - `size="large"` 现在会正确应用大尺寸描述文字样式。 ## API ### Cell.Group Props | 参数 | 说明 | 类型 | 默认值 | | --------- | ------------- | ----------- | ------- | | title | 分组标题 | _ReactNode_ | `-` | | inset | 是否展示为圆角卡片风格 | _boolean_ | `false` | | bordered | 是否显示非卡片模式的外边框 | _boolean_ | `true` | | clickable | 是否为子单元格开启点击反馈 | _boolean_ | `false` | ### Cell Props | 参数 | 说明 | 类型 | 默认值 | | -------------------------- | ------------------------------------------------------ | --------------- | -------- | | title | 左侧标题 | _ReactNode_ | `-` | | children | 右侧内容 | _ReactNode_ | `-` | | brief | 标题下方的描述信息 | _ReactNode_ | `-` | | size | 单元格大小,可选值为 `normal` `large`,`medium` 已废弃 | _string_ | `normal` | | icon | 左侧[图标](/components/icon.md)或[图片](/components/image.md) | _ReactNode_ | `-` | | rightIcon | 右侧自定义图标 | _ReactNode_ | `-` | | extra | 右侧图标之后的额外内容 | _ReactNode_ | `-` | | bordered | 是否显示内边框 | _boolean_ | `true` | | clickable | 是否开启点击反馈,显式值优先于分组和链接状态 | _boolean_ | `-` | | isLink | 是否展示右侧箭头并开启点击反馈 | _boolean_ | `false` | | arrowDirection | 箭头方向,可选值为 `left` `right` `up` `down` | _string_ | `right` | | required | 是否显示表单必填星号 | _boolean_ | `false` | | align | 对齐方式,可选值为 `start` `center` `end` | _string_ | `-` | | titleStyle | 左侧标题额外样式 | _CSSProperties_ | `-` | | titleClass | 左侧标题额外类名 | _string_ | `-` | | valueClass | 右侧内容额外类名 | _string_ | `-` | | briefClass | 标题下方的描述信息额外类名 | _string_ | `-` | `Cell` 还继承了 Taro `View` 的原生属性。 ### Cell.Link Props v1.0.1 `Cell.Link` 支持 Cell 内容与样式属性,并继承 Taro `Navigator` 的 `url`、`openType`、`target` 等原生属性。`isLink` 和 `clickable` 的默认值均为 `true`。 ### Cell Events | 事件名 | 说明 | 回调参数 | | ------- | -------- | -------------------- | | onClick | 点击单元格时触发 | _event: ITouchEvent_ | ## 主题定制 ### 样式变量 组件提供了下列 CSS 变量,可用于自定义样式,使用方法请参考 [ConfigProvider](/components/config-provider/index.md) 组件。 | 名称 | 默认值 | 描述 | | -------------------------------------------------- | ------------------------------------------------------------------------- | -- | | --cell-font-size | _var(--font-size-md)_ | - | | --cell-line-height | _24px \* $hd_ | - | | --cell-color | _var(--text-color)_ | - | | --cell-background-color | _var(--background-color-2)_ | - | | --cell-border-color | _var(--border-color)_ | - | | --cell-value-color | _var(--gray-6)_ | - | | --cell-value-font-size | _inherit_ | - | | --cell-active-color | _var(--active-color)_ | - | | --cell-required-color | _var(--danger-color)_ | - | | --cell-required-padding-right | _2px \* $hd_ | - | | --cell-icon-size | _16px \* $hd_ | - | | --cell-left-icon-margin-right | _4px \* $hd_ | - | | --cell-right-icon-margin-left | _4px \* $hd_ | - | | --cell-right-icon-color | _var(--cell-value-color)_ | - | | --cell-extra-margin-left | _var(--padding-base)_ | - | | --cell-icon-margin-left | _4px \* $hd_ | - | | --cell-right-icon-margin-right | _4px \* $hd_ | - | | --cell-brief-margin-top | _var(--padding-base)_ | - | | --cell-brief-font-size | _var(--font-size-sm)_ | - | | --cell-brief-line-height | _var(--line-height-sm)_ | - | | --cell-brief-color | _var(--gray-6)_ | - | | --cell-vertical-padding | _10px \* $hd_ | - | | --cell-horizontal-padding | _var(--padding-md)_ | - | | --cell-vertical-padding-large | _var(--padding-sm)_ | - | | --cell-title-font-size-large | _var(--font-size-lg)_ | - | | --cell-brief-font-size-large | _var(--font-size-md)_ | - | | --cell-value-font-size-large | _inherit_ | - | | --cell-subtitle-font-size-large | _var(--font-size-md)_ | - | | --cell-group-background-color | _var(--background-color-2)_ | - | | --cell-group-title-color | _var(--gray-6)_ | - | | --cell-group-title-padding | _var(--padding-md) var(--padding-md) var(--padding-xs)_ | - | | --cell-group-title-font-size | _var(--font-size-md)_ | - | | --cell-group-title-line-height | _16px \* $hd_ | - | | --cell-group-inset-padding | _0 var(--padding-md)_ | - | | --cell-group-inset-border-radius | _var(--border-radius-lg)_ | - | | --cell-group-inset-title-padding | _var(--padding-md) var(--padding-md) var(--padding-xs) var(--padding-xl)_ | - | --- url: https://taroify.com/components/config-provider/index.md --- # ConfigProvider 全局配置 ### 介绍 用于配置 Taroify 组件的主题样式。 ### 引入 ```tsx import { ConfigProvider } from "@taroify/core"; ``` ## 定制主题 ### 介绍 Taroify 组件通过丰富的 [CSS 变量](https://developer.mozilla.org/zh-CN/docs/Web/CSS/Using_CSS_custom_properties) 来组织样式,通过覆盖这些 CSS 变量,可以实现**定制主题、动态切换主题**等效果。 #### 示例 以 Button 组件为例,查看组件的样式,可以看到 `.taroify-button--primary` 类名上存在以下变量: ```scss .taroify-button--primary { color: var(--button-primary-color); background-color: var(--button-primary-background-color); } ``` ### 自定义 CSS 变量 #### 通过 CSS 覆盖 你可以直接在代码中覆盖这些 CSS 变量,Button 组件的样式会随之发生改变: ```css /* 添加这段样式后,Primary Button 会变成红色 */ :root { --button-primary-background-color: red; } ``` > 注意:小程序不存在 `:root` 元素,只能在 `page` 根元素里覆盖 CSS 变量。 #### 通过 ConfigProvider 覆盖 `ConfigProvider` 组件提供了覆盖 CSS 变量的能力,你需要在根节点包裹一个 `ConfigProvider` 组件,并通过 `theme` 属性来配置一些主题变量。 ```tsx function CustomThemeVars() { const [rate, setRate] = useState(4) const [slider, setSlider] = useState(50) return ( ) } ``` > 注意:ConfigProvider 仅影响它的子组件的样式,不影响全局 root 节点。在小程序中 ConfigProvider 不能放置在 `app.ts` 文件里,因为 `app.ts` 文件不能渲染任何内容。 #### 暗色模式 将 `themeMode` 设置为 `dark`,可以启用内置的暗色主题。`theme` 中的自定义变量会覆盖暗色主题的默认变量。 ```tsx ``` 如果需要跟随微信系统主题,应在应用配置中启用 `darkmode` 和 `themeLocation`,然后通过 `Taro.onThemeChange` 更新 `themeMode`: ```tsx const [themeMode, setThemeMode] = useState("light") useEffect(() => { const listener = ({ theme }) => setThemeMode(theme) Taro.onThemeChange(listener) return () => Taro.offThemeChange(listener) }, []) return {children} ``` #### 在 TypeScript 中使用 在 TypeScript 中定义 themeVars 时,建议使用 Taroify 提供的 ConfigProviderThemeVars 类型,可以提供完善的类型提示: ```ts import type { ConfigProviderThemeVars } from '@taroify/core'; const themeVars: ConfigProviderThemeVars = { rateIconFullColor: "#07c160", sliderTrackHeight: "4px", sliderActiveBackgroundColor: "#07c160", buttonPrimaryBorderColor: "#07c160", buttonPrimaryBackgroundColor: "#07c160", }; ``` ### 基础变量 Taroify 中的 CSS 变量分为 **基础变量** 和 **组件变量**。组件变量会继承基础变量,因此在修改基础变量后,会影响所有相关的组件。 #### 变量列表 下面是所有的基础变量: ```scss // Color Palette --black: #000; --white: #fff; --gray-1: #f7f8fa; --gray-2: #f2f3f5; --gray-3: #ebedf0; --gray-4: #dcdee0; --gray-5: #c8c9cc; --gray-6: #969799; --gray-7: #646566; --gray-8: #323233; --red: #ee0a24; --blue: #1989fa; --orange: #ff976a; --orange-dark: #ed6a0c; --orange-light: #fffbe8; --green: #07c160; // Gradient Colors --gradient-red: linear-gradient(to right, #ff6034, #ee0a24); --gradient-orange: linear-gradient(to right, #ffd01e, #ff8917); // Component Colors --primary-color: var(--blue); --success-color: var(--green); --danger-color: var(--red); --warning-color: var(--orange); --text-color: var(--gray-8); --text-color-2: var(--gray-6); --text-color-3: var(--gray-5); --active-color: var(--gray-2); --active-opacity: 0.7; --disabled-opacity: 0.5; --background-color: var(--gray-1); --background-color-2: var(--white); --background-color-light: var(--background-color-2); --text-link-color: #576b95; // Padding --padding-base: 4px; --padding-xs: 8px; --padding-sm: 12px; --padding-md: 16px; --padding-lg: 24px; --padding-xl: 32px; // Font --font-size-xs: 10px; --font-size-sm: 12px; --font-size-md: 14px; --font-size-lg: 16px; --font-weight-bold: 500; --line-height-xs: 14px; --line-height-sm: 18px; --line-height-md: 20px; --line-height-lg: 22px; --base-font-family: -apple-system, BlinkMacSystemFont, 'Helvetica Neue', Helvetica, Segoe UI, Arial, Roboto, 'PingFang SC', 'miui', 'Hiragino Sans GB', 'Microsoft Yahei', sans-serif; --price-integer-font-family: Avenir-Heavy, PingFang SC, Helvetica Neue, Arial, sans-serif; // Animation --animation-duration-base: 0.3s; --animation-duration-fast: 0.2s; --animation-timing-function-enter: ease-out; --animation-timing-function-leave: ease-in; // Border --border-color: var(--gray-3); --border-width-base: 1px; --border-radius-sm: 2px; --border-radius-md: 4px; --border-radius-lg: 8px; --border-radius-max: 999px; ``` 你可以在各个组件文档底部的表格中查看组件变量。 ## API ### Props | 参数 | 说明 | 类型 | 默认值 | | ------------------------------ | ----------------- | ------------------------- | ----- | | theme | 自定义主题变量,优先级高于内置主题 | _ConfigProviderThemeVars_ | - | | themeMode | 主题模式 | _light \| dark_ | light | --- url: https://taroify.com/components/icon/index.md --- # Icon 图标 ### 介绍 基于字体的图标集,可以通过 Icon 组件使用,也可以在其他组件中通过 `icon` 属性引用。 ### 引入 ```tsx import { ChatOutlined } from "@taroify/icons" ``` ## 代码演示 ### 基础用法 通过导入的方式引用需要使用的图标,Taroify 内置了一套 Vant 图标库(见右侧示例),可以直接复制对应的名称来使用。 ```tsx ``` ### 图片图标 通过 `src` 属性可以将图片作为图标,图片尺寸会跟随图标的 `size` 属性。 ```tsx import { Icon } from "@taroify/icons" ``` ### 徽标提示 与 Badge 组件组合使用,会在图标右上角展示相应的徽标。 ```tsx ``` ### 图标颜色 通过 `style` 属性来设置图标的颜色。 ```tsx ``` ### 图标大小 通过 `size` 属性来设置图标的尺寸大小,可以指定任意 CSS 单位。 ```tsx ``` ### 自定义图标 如果需要在现有 Icon 的基础上使用更多图标,可以引入第三方 iconfont 对应的字体文件和 CSS 文件,之后就可以在 Icon 组件中直接使用。 请升级 `taroify` 到 >= `v0.3.0-alpha.0` 版本来使用该特性。 ```css /* 引入第三方或自定义的字体图标样式 */ @font-face { font-family: "my-icon"; src: url("./my-icon.ttf") format("truetype"); } .my-icon { font-family: "my-icon"; } .my-icon-extra::before { content: "\e626"; } ``` ```tsx import { Icon } from "@taroify/icons" ``` ## API ### Props | 参数 | 说明 | 类型 | 默认值 | | ----------- | ------------------------------ | ------------------ | ---------- | | color | 图标颜色 | _string_ | `inherit` | | size | 图标大小,如 `20px` `2em`,默认单位为 `px` | _number \| string_ | `inherit` | | src | 图片图标地址 | _string_ | - | | classPrefix | 类名前缀,用于使用自定义图标 | _string_ | `van-icon` | ### Events | 事件名 | 说明 | 回调参数 | | ------- | ------- | -------------------- | | onClick | 点击图标时触发 | _event: ITouchEvent_ | --- url: https://taroify.com/components/image/index.md --- # Image 图片 ### 介绍 增强版的 taro Image 组件,提供多种图片填充模式,支持图片懒加载、加载中提示、加载失败提示。 ### 引入 ```tsx import { Image } from "@taroify/core" ``` ## 代码演示 ### 基础用法 基础用法与 Taro `Image` 组件一致,支持 `webp` 、`fadeIn` 、`showMenuByLongpress` 等原生图片属性,也可以设置 H5 的 `imgProps` 。 通过 `width` 和 `height` 设置图片大小,若未指定,会从 style 中读取`width` ,`height` 属性。 `width` 、`height` 和 `radius` 为 number 时,会经过 `pxTransform` 转换。 ```tsx ``` ### 填充模式 通过 `mode` 属性可以设置图片填充模式,可选值见下方表格。 ```tsx ``` ### 圆形图片 通过 `shape="circle"` 设置圆形图片,可以配合 `mode` 属性展示不同的填充效果。 ```tsx ``` ### 圆角图片 v1.0.2 通过 `shape="rounded"` 设置默认圆角,通过 `radius` 属性自定义圆角大小。 ```tsx ``` ### 图片懒加载 设置 `lazyLoad` 属性来开启图片懒加载。 ```tsx ``` ### 加载中提示 通过 `placeholder` 设置加载中提示。设置为 `true` 时使用默认图标,也可以传入文本或自定义节点。 ```tsx import { Photo } from "@taroify/icons" } /> ``` ### 加载失败提示 通过 `fallback` 设置加载失败提示。设置为 `true` 时使用默认图标,也可以传入文本或自定义节点。 ```tsx import { PhotoFail } from "@taroify/icons" } /> ``` ## API ### Props | 参数 | 说明 | 类型 | 默认值 | | --------------------------- | -------------------------------- | ---------------------- | ------------- | | src | 图片链接 | _string_ | - | | mode | 图片填充模式 | _ImageMode_ | `scaleToFill` | | alt | 替代文本 | _string_ | - | | width | 宽度 | _string \| number_ | - | | height | 高度 | _string \| number_ | - | | shape | 图片形状 `square` `rounded` `circle` | _ImageShape_ | - | | radius | 圆角大小 | _string \| number_ | - | | lazyLoad | 是否开启图片懒加载 | _boolean_ | `false` | | placeholder | 加载中提示 | _boolean \| ReactNode_ | `false` | | fallback | 加载失败提示 | _boolean \| ReactNode_ | `false` | ### Modes | 名称 | 含义 | | ----------- | ------------------------------------------------------------------ | | scaleToFill | 缩放模式,不保持纵横比缩放图片,使图片的宽高完全拉伸至填满 image 元素 | | aspectFit | 缩放模式,保持纵横比缩放图片,使图片的长边能完全显示出来。也就是说,可以完整地将图片显示出来。 | | aspectFill | 缩放模式,保持纵横比缩放图片,只保证图片的短边能完全显示出来。也就是说,图片通常只在水平或垂直方向是完整的,另一个方向将会发生截取。 | | widthFix | 缩放模式,宽度不变,高度自动变化,保持原图宽高比不变 | | heightFix | 缩放模式,高度不变,宽度自动变化,保持原图宽高比不变 | | top | 裁剪模式,不缩放图片,只显示图片的顶部区域 | | bottom | 裁剪模式,不缩放图片,只显示图片的底部区域 | | center | 裁剪模式,不缩放图片,只显示图片的中间区域 | | left | 裁剪模式,不缩放图片,只显示图片的左边区域 | | right | 裁剪模式,不缩放图片,只显示图片的右边区域 | | topLeft | 裁剪模式,不缩放图片,只显示图片的左上边区域 | | topRight | 裁剪模式,不缩放图片,只显示图片的右上边区域 | | bottomLeft | 裁剪模式,不缩放图片,只显示图片的左下边区域 | | bottomRight | 裁剪模式,不缩放图片,只显示图片的右下边区域 | ### Events | 事件名 | 说明 | 回调参数 | | ------- | --------- | ------------------------ | | onClick | 点击图片时触发 | _event: ITouchEvent_ | | onLoad | 图片加载完毕时触发 | _event: ImageLoadEvent_ | | onError | 图片加载失败时触发 | _event: ImageErrorEvent_ | ## 主题定制 ### 样式变量 组件提供了下列 CSS 变量,可用于自定义样式,使用方法请参考 [ConfigProvider](/components/config-provider/index.md) 组件。 | 名称 | 默认值 | 描述 | | ------------------------------------ | ------------------------- | -- | | --image-placeholder-color | _var(var(--gray-6)_ | - | | --image-placeholder-font-size | _var(--font-size-md)_ | - | | --image-placeholder-icon-size | _32px \* $hd_ | - | | --image-placeholder-icon-color | _var(--gray-4)_ | - | | --image-placeholder-background-color | _var(--background-color)_ | - | --- url: https://taroify.com/components/flex/index.md --- # Flex 布局 ### 介绍 `Flex` 组件是 CSS `flex` 布局的一个封装。 ### 引入 ```tsx import { Flex } from "@taroify/core" ``` ## 代码演示 ### 基础用法 `Flex` 组件提供了 `24列栅格`,通过在 `Flex.Item` 上添加 `span` 属性设置列所占的宽度百分比。此外,添加 `offset` 属性可以设置列的偏移宽度,计算方式与 span 相同。 ```tsx span: 8 span: 8 span: 8 span: 4 offset: 4, span: 10 offset: 12, span: 12 ``` ### 设置列元素间距 通过 `gutter` 属性可以设置列元素之间的间距,默认间距为 0。 ```tsx span: 8 span: 8 span: 8 ``` ### 垂直间距 v1.0.2 通过数组形式设置 `[水平间距, 垂直间距]`。`Flex` 默认不换行,使用垂直间距时需要同时设置 `wrap="wrap"`。 ```tsx span: 12 span: 12 span: 12 span: 12 ``` ### 对齐方式 通过 `justify` 属性可以设置主轴上内容的对齐方式,等价于 flex 布局中的 `justify-content` 属性。 ```tsx span: 6 span: 6 span: 6 span: 6 span: 6 span: 6 span: 6 span: 6 span: 6 span: 6 span: 6 span: 6 ``` ## API ### Flex Props | 参数 | 说明 | 类型 | 默认值 | | --------- | ------------------------------------------------------------------ | ----------------------------------------------------------- | -------- | | gutter | 列元素之间的间距,数组第一项为水平间距、第二项为垂直间距(单位为 px) | _number \| string \| \[number \| string, number \| string]_ | - | | direction | 项目定位方向,可选值为 `row` `row-reverse` `column` `column-reverse` | _FlexDirection_ | `row` | | wrap | 子元素的换行方式,可选值为 `nowrap` `wrap` `wrap-reverse` | _FlexWrap_ | `nowrap` | | justify | 主轴对齐方式,可选值为 `start` `end` `center` `space-around` `space-between` | _FlexJustify_ | `start` | | align | 交叉轴对齐方式,可选值为 `start` `center` `end` `baseline` `stretch` `initial` | _FlexAlign_ | `start` | ### Flex.Item Props | 参数 | 说明 | 类型 | 默认值 | | ------ | ------- | ------------------ | --- | | span | 列元素宽度 | _number \| string_ | - | | offset | 列元素偏移距离 | _number \| string_ | - | ### 类型定义 组件导出以下类型定义: ```tsx import type { FlexAlign, FlexDirection, FlexGutter, FlexGutterValue, FlexItemProps, FlexJustify, FlexProps, FlexWrap, } from "@taroify/core" ``` --- url: https://taroify.com/components/popup/index.md --- # Popup 弹出层 ### 介绍 弹出层容器,用于展示弹窗、信息提示等内容,支持多个弹出层叠加展示。 ### 引入 ```tsx import { Popup } from "@taroify/core" ``` ## 代码演示 ### 基础用法 通过 `open` 控制弹出层是否展示。 ```tsx const [open, setOpen] = useState(false) 内容 ``` ### 弹出位置 通过 `placement` 属性设置弹出位置,默认居中弹出,可以设置为 `top`、`bottom`、`left`、`right`。 ```tsx ``` ### 关闭图标 v1.0.2 设置 `closeable` 属性后,会在弹出层的右上角显示关闭图标。通过 `closeIcon` 自定义图标,通过 `closeIconPlacement` 设置图标位置。 ```tsx } closeIconPlacement="bottom-right" placement="bottom" style={{ height: "30%" }} /> ``` 也可以使用 `Popup.Close` 自定义关闭图标。 ```tsx ``` ### 遮罩层 v1.0.2 通过 `backdrop` 隐藏遮罩层,或传入对象配置遮罩层属性。`closeOnClickBackdrop` 用于控制点击遮罩层时是否关闭弹出层。 ```tsx ``` ### 关闭前回调 v1.0.2 通过 `beforeClose` 属性可以在关闭前执行同步或异步逻辑,返回 `true` 时关闭,返回其他值或 Promise 被拒绝时保持打开。 ```tsx import type { PopupCloseAction } from "@taroify/core" function beforeClose(action: PopupCloseAction) { return new Promise((resolve) => { setTimeout(() => resolve(action === "close"), 1000) }) } ``` ### 销毁内容 v1.0.2 默认情况下,弹出层关闭后内容仍会保留。设置 `destroyOnClose` 后,内容会在离场动画结束后卸载。 ```tsx ``` ### 圆角弹窗 设置 `rounded` 属性后,弹窗会根据弹出位置添加不同的圆角样式。 ```tsx 内容 ``` ### 禁止滚动穿透 ```tsx 无法滑动 ``` 如果需要内容支持溢出滚动,则需要包裹一层 `ScrollView` 组件。 ```tsx 可以滑动 ``` ## API ### Popup Props | 参数 | 说明 | 类型 | 默认值 | | ----------------------------------------- | --------------------------------------------------------------- | ------------------------------------------------------------ | ------------------- | | defaultOpen | 默认是否显示弹出层 | _boolean_ | `false` | | open | 是否显示弹出层 | _boolean_ | `false` | | placement | 弹出位置,可选值为 `top` `bottom` `right` `left` `center` | _PopupPlacement_ | `center` | | duration | 动画时长,单位毫秒 | _number_ | `300` | | rounded | 是否显示圆角 | _boolean_ | `false` | | lock | 是否锁定背景滚动 | _boolean_ | `true` | | backdrop | 是否显示遮罩层,或传入遮罩层配置 | _boolean \| Omit\_ | `true` | | closeOnClickBackdrop | 点击遮罩层时是否关闭弹出层 | _boolean_ | `true` | | closeable | 是否显示关闭图标 | _boolean_ | `false` | | closeIcon | 自定义关闭图标 | _ReactNode_ | `` | | closeIconPlacement | 关闭图标位置,可选值为 `top-left` `top-right` `bottom-left` `bottom-right` | _PopupClosePlacement_ | `top-right` | | beforeClose | 关闭前的回调函数,返回 `true` 时关闭 | _(action: PopupCloseAction) => boolean \| Promise\_ | - | | destroyOnClose | 关闭后是否卸载弹出层内容 | _boolean_ | `false` | | mountOnEnter | 首次打开时是否挂载弹出层内容 | _boolean_ | `true` | | transitionAppear | 首次挂载且已打开时是否执行入场动画 | _boolean_ | `true` | | transition | 动画名称 | _string_ | 根据 `placement` 自动设置 | | transitionTimeout | 动画超时时间,单位毫秒 | _PopupTransitionTimeout_ | `duration` | | transaction | 请使用 `transition` | _string_ | - | | transactionTimeout | 请使用 `transitionTimeout` | _PopupTransitionTimeout_ | - | 动画相关参数继承自 `Transition` 组件,详细属性参见:[Transition 组件](/components/style/index.md#动画)。 | Popup 参数 | Transition 对应参数 | | ------------------- | --------------- | | mountOnEnter | mountOnEnter | | transition | name | | transitionAppear | appear | | transitionTimeout | timeout | | onTransitionEnter | onEnter | | onTransitionEntered | onEntered | | onTransitionExit | onExit | | onTransitionExited | onExited | ### Popup.Backdrop Props | 参数 | 说明 | 类型 | 默认值 | | --------- | ------------- | --------------- | ------ | | className | 遮罩层类名 | _string_ | - | | style | 遮罩层样式 | _CSSProperties_ | - | | open | 是否显示遮罩层 | _boolean_ | `true` | | closeable | 点击遮罩层后是否关闭弹出层 | _boolean_ | `true` | | duration | 动画时长,单位毫秒 | _number_ | `300` | | lock | 是否锁定背景滚动 | _boolean_ | `true` | ### Popup.Close Props | 参数 | 说明 | 类型 | 默认值 | | ---------------------------- | --------------------------------------------------------------- | ------------------------------ | ----------- | | placement | 关闭图标位置,可选值为 `top-left` `top-right` `bottom-left` `bottom-right` | _PopupClosePlacement_ | `top-right` | | children | 图标内容 | _ReactNode_ | `` | | onClick | 点击关闭图标时触发 | _(event: ITouchEvent) => void_ | - | ### Events | 事件名 | 说明 | 回调参数 | | ----------------------------- | --------------- | -------------------- | | onClick | 点击弹出层时触发 | _event: ITouchEvent_ | | onOpen | 打开弹出层且入场动画开始时触发 | - | | onOpened | 入场动画结束时触发 | - | | onClose | 关闭弹出层时触发 | _opened: boolean_ | | onClosed | 离场动画结束时触发 | - | ### 类型定义 组件相关类型可从 `@taroify/core` 直接导入: ```tsx import type { PopupBackdropProps, PopupCloseAction, PopupClosePlacement, PopupCloseProps, PopupPlacement, PopupProps, PopupThemeVars, PopupTransitionTimeout, } from "@taroify/core" ``` ## 主题定制 ### 样式变量 组件提供了下列 CSS 变量,可用于自定义样式,使用方法请参考 [ConfigProvider](/components/config-provider/index.md) 组件。 | 名称 | 默认值 | 描述 | | ------------------------------- | -------------------------------- | -- | | --popup-z-index | _1010_ | - | | --popup-background-color | _var(--background-color-light)_ | - | | --popup-animation-duration | _var(--animation-duration-base)_ | - | | --popup-rounded-border-radius | _16px \* $hd_ | - | | --popup-close-icon-z-index | _1_ | - | | --popup-close-icon-size | _22px \* $hd_ | - | | --popup-close-icon-color | _var(--gray-5)_ | - | | --popup-close-icon-active-color | _var(--gray-6)_ | - | | --popup-close-icon-margin | _16px \* $hd_ | - | --- url: https://taroify.com/components/style/index.md --- # 内置样式 ### 介绍 Taroify 中默认包含了一些常用样式,可以直接通过 className 的方式使用。 ### 文字省略 当文本内容长度超过容器最大宽度时,自动省略多余的文本。 ```jsx 这是一段最多显示一行的文字,多余的内容会被省略 这是一段最多显示两行的文字,多余的内容会被省略 这是一段最多显示三行的文字,多余的内容会被省略 ``` ### 1px 边框 为元素添加 Retina 屏幕下的 1px 边框(即 hairline),基于伪类 transform 实现。 ```jsx ``` ### 触摸反馈 为元素添加触碰反馈效果,触碰后,元素的透明度会降低。 ```tsx ``` 为元素添加触碰反馈效果,触碰后,元素的背景色会改变。 ```tsx ``` ### 动画 可以通过 `Transition` 组件使用内置的动画 ```jsx Fade Slide Up Slide Down Slide Left Slide Right ``` Transition来源于 `react-transition-group` 的 `CSSTransition`,详情请查看其[文档](https://reactcommunity.org/react-transition-group/css-transition) ```tsx interface TransitionProps { name?: TransitionName | string in?: boolean appear?: boolean mountOnEnter?: boolean unmountOnExit?: boolean timeout?: number | { appear?: number; enter?: number; exit?: number } children?: ReactNode onEnter?: EnterHandler onEntering?: EnterHandler onEntered?: EnterHandler onExit?: ExitHandler onExiting?: ExitHandler onExited?: ExitHandler } ``` --- url: https://taroify.com/components/toast/index.md --- # Toast 轻提示 ### 介绍 在页面中间弹出黑色半透明提示,用于消息通知、加载提示、操作结果提示等场景。 ### 函数调用 版本 >= `v0.6.0-alpha.0`可以直接调用。低版本需要手动在页面(page)里挂载一个 Toast 组件并指定 id 为 `toast`。 ```tsx import { Cell, Toast } from "@taroify/core" function ImperativeToast() { return ( <> {/* */} Toast.open("文字提示")} /> ) } ``` ### 组件调用 ```tsx import { Cell, Toast } from "@taroify/core" function BasicToast() { const [open, setOpen] = useState(false) return ( <> 文字提示 setOpen(true)} /> ) } ``` ## 代码演示 ### 加载提示 使用 `type="loading"` 方法展示加载提示。 ```ts Toast.open({ type: "loading", message: "加载中..." })} ``` ```tsx 加载中... ``` ### 成功/失败提示 使用 `type="success"` 展示成功提示,使用 `type="fail"` 展示失败提示。 ```ts Toast.open({ type: "success", message: "成功文案" }) Toast.open({ type: "fail", message: "失败文案" }) ``` ```tsx 成功文案 失败文案 ``` ### 自定义图标 通过 `icon` 选项可以自定义图标,支持传入[图标名称](/components/icon.md)或图片链接。 ```ts Toast.open({ message: "自定义图标", icon: }) Toast.open({ message: "自定义图片", icon: ( ), }) ``` ```tsx }>自定义图标 } > 自定义图片 }>加载中... ``` ### 自定义位置 Toast 默认渲染在屏幕正中位置,通过 `position` 属性可以控制 Toast 展示的位置。 ```ts Toast.open({ position: "top", message: "顶部展示", }) Toast.open({ position: "bottom", message: "顶部展示", }) ``` ```tsx 顶部展示 底部展示 ``` ### 多例模式 Toast 默认采用单例模式,即同一时间只会存在一个 Toast。通过调用 `Toast.allowMultiple(true)` 可以在页面中同时存在多个 Toast 实例。 ```tsx import { Cell, Toast } from "@taroify/core" function MultipleToast() { return ( <> { Toast.allowMultiple(true) // 同时展示多个 Toast Toast.success("成功提示") setTimeout(() => { Toast.fail("失败提示") }, 1000) }} /> ) } ``` ### 关闭特定 Toast 实例 在多例模式下,`Toast.open()`、`Toast.success()`、`Toast.fail()` 和 `Toast.loading()` 方法会返回一个唯一标识符,可以使用该标识符来关闭特定的 Toast 实例。 ```tsx import { Cell, Toast } from "@taroify/core" function MultipleToastClose() { return ( <> { // 启用多例模式 Toast.allowMultiple(true) // 创建并保存 Toast 实例标识符 const toast1 = Toast.success("成功提示") const toast2 = Toast.loading("加载中...") // 3秒后只关闭成功提示,保留加载提示 setTimeout(() => { // 直接使用 close 方法关闭特定的 Toast if (toast1) { Toast.close(toast1) } }, 3000) }} /> ) } ``` ## API ### Props | 参数 | 说明 | 类型 | 默认值 | | ----------- | ---------------------------------------------- | -------------------------- | -------- | | defaultOpen | 默认是否显示弹出层 | _boolean_ | `false` | | open | 是否显示弹出层 | _boolean_ | `false` | | type | 提示类型,可选值为 `loading` `success`
`fail` `html` | _string_ | `text` | | icon | 自定义图标,支持传入[图标名称](/components/icon.md)或图片链接 | _ReactNode_ | - | | position | 弹出位置,可选值为 `top` `bottom` | _string_ | `center` | | duration | 动画时长,单位毫秒,值为 0 时,toast 不会消失 | _number \| string_ | `3000` | | backdrop | 是否显示遮罩层 | _boolean_ | `false` | | children | 文本内容 | _ReactNode_ | - | | onClose | 关闭时的回调函数 | _(open : boolean) => void_ | - | ### Options | 参数 | 说明 | 类型 | 默认值 | | -------- | -------------------------------------------------------------- | -------------------------- | -------- | | selector | 自定义节点选择器 | _string_ | `toast` | | type | 提示类型,可选值为 `loading` `success`
`fail` `html` | _string_ | `text` | | icon | 自定义图标,支持传入[图标](/components/icon.md)或[图片](/components/image.md) | _ReactNode_ | - | | position | 弹出位置,可选值为 `top` `bottom` | _string_ | `center` | | duration | 动画时长,单位毫秒,值为 0 时,toast 不会消失 | _number \| string_ | `3000` | | backdrop | 是否显示遮罩层 | _boolean_ | `false` | | message | 文本内容 | _ReactNode_ | - | | onClose | 关闭时的回调函数 | _(open : boolean) => void_ | - | ### 方法 | 方法名 | 参数 | 返回值 | 介绍 | | ------------------- | -------------------- | --------------------- | ------------------------------ | | Toast.open | _options \| message_ | _string \| undefined_ | 展示提示,返回 Toast 实例标识符 | | Toast.loading | _options \| message_ | _string \| undefined_ | 展示加载提示,返回 Toast 实例标识符 | | Toast.success | _options \| message_ | _string \| undefined_ | 展示成功提示,返回 Toast 实例标识符 | | Toast.fail | _options \| message_ | _string \| undefined_ | 展示失败提示,返回 Toast 实例标识符 | | Toast.close | _selector? \| id?_ | - | 关闭提示,不传参时关闭所有提示,传入实例标识符时关闭指定提示 | | Toast.allowMultiple | _boolean_ | - | 允许同时存在多个 Toast 提示,默认为 `false` | ## 主题定制 ### 样式变量 组件提供了下列 CSS 变量,可用于自定义样式,使用方法请参考 [ConfigProvider](/components/config-provider/index.md) 组件。 | 名称 | 默认值 | 描述 | | -------------------------------- | ------------------------------------- | -- | | --toast-width | _88px \* $hd_ | - | | --toast-width | _88px \* $hd_ | - | | --toast-min-height | _88px \* $hd_ | - | | --toast-max-width | _70%_ | - | | --toast-padding | _var(--padding-md)_ | - | | --toast-font-size | _var(--font-size-md)_ | - | | --toast-line-height | _var(--line-height-md)_ | - | | --toast-color | _var(--white)_ | - | | --toast-background-color | _rgba(var(--black-rgb), $alpha: 0.7)_ | - | | --toast-border-radius | _var(--border-radius-lg)_ | - | | --toast-transition-duration | _var(--animation-duration-fast)_ | - | | --toast-icon-font-size | _36px \* $hd_ | - | | --toast-icon-color | _var(--white)_ | - | | --toast-loading-padding | _3px \* $hd_ | - | | --toast-loading-color | _var(--white)_ | - | | --toast-text-min-width | _96px \* $hd_ | - | | --toast-text-padding | _var(--padding-xs) var(--padding-sm)_ | - | | --toast-position-distance | _20%_ | - | | --toast-position-top-distance | _var(--toast-position-distance)_ | - | | --toast-position-bottom-distance | _var(--toast-position-distance)_ | - | --- url: https://taroify.com/components/space/index.md --- # Space 间距 ### 介绍 设置组件之间的间距。 ### 引入 ```tsx import { Button, Space } from "@taroify/core" ``` ## 代码演示 ### 基础用法 ```tsx ``` ### 垂直 ```tsx ``` ### 间距 ```tsx ``` ### 自定义间距 通过 `size` 设置间距。传入数字时会通过 Taro 的尺寸转换处理;也可以传入带单位的字符串、CSS 变量,或者使用数组分别设置 `[水平间距, 垂直间距]`。 ```tsx ``` ### 分隔符 v1.0.2 通过 `separator` 在相邻子元素之间设置分隔内容。 ```tsx ``` ### 居中 ```tsx ``` ### 不换行 ```tsx ``` ## API ### Props | 参数 | 说明 | 类型 | 默认值 | | ------------------------------ | ----------------------------------------------------------------- | ---------------- | ------------ | | direction | 排列方向,可选值为 `horizontal` `vertical` | _SpaceDirection_ | `horizontal` | | size | 间距大小,数组依次表示水平和垂直间距 | _SpaceSize_ | `small` | | wrap | 子元素的换行方式,可选值为 `nowrap` `wrap` `wrap-reverse` | _SpaceWrap_ | `wrap` | | justify | 主轴对齐方式,可选值为 `start` `end` `center` `space-around` `space-between` | _SpaceJustify_ | `start` | | align | 交叉轴对齐方式,可选值为 `start` `center` `end` `baseline` `stretch` | _SpaceAlign_ | `start` | | fill | 是否填充整个父元素 | _boolean_ | `false` | | separator | 相邻子元素之间的分隔内容 | _ReactNode_ | - | ### 类型定义 组件导出以下类型定义: ```ts import type { SpaceAlign, SpaceDirection, SpaceJustify, SpaceProps, SpaceSize, SpaceSizePreset, SpaceSizeValue, SpaceThemeVars, SpaceWrap, } from "@taroify/core" ``` `SpaceSize` 支持预设尺寸、数字、带单位的字符串、CSS 变量,以及由这些值组成的数组: ```ts type SpaceSize = | "mini" | "small" | "medium" | "large" | number | string | [number | string, (number | string)?] ``` ## 主题定制 ### 样式变量 组件提供了下列 CSS 变量,可用于自定义样式,使用方法请参考 [ConfigProvider](/components/config-provider/index.md) 组件。 | 名称 | 默认值 | 描述 | | ---------------------------------- | ------------------------------ | -- | | --space-item-gap-mini | _var(--padding-xs)_ | - | | --space-item-gap-small | _var(--padding-sm)_ | - | | --space-item-gap-medium | _var(--padding-md)_ | - | | --space-item-gap-large | _var(--padding-lg)_ | - | | --space-item-vertical-gap-mini | _var(--space-item-gap-mini)_ | - | | --space-item-vertical-gap-small | _var(--space-item-gap-small)_ | - | | --space-item-vertical-gap-medium | _var(--space-item-gap-medium)_ | - | | --space-item-vertical-gap-large | _var(--space-item-gap-large)_ | - | | --space-item-horizontal-gap-mini | _var(--space-item-gap-mini)_ | - | | --space-item-horizontal-gap-small | _var(--space-item-gap-small)_ | - | | --space-item-horizontal-gap-medium | _var(--space-item-gap-medium)_ | - | | --space-item-horizontal-gap-large | _var(--space-item-gap-large)_ | - | --- url: https://taroify.com/components/safe-area/index.md --- # SafeArea 安全区 ### 介绍 用于将其内容放置在视口的安全区域中。 ### 引入 ```tsx import { SafeArea } from "@taroify/core" ``` ## 代码演示 ### 基础用法 ```tsx {lorem.generateParagraphs(10)} ``` ## API ### SafeArea Props | 参数 | 说明 | 类型 | 默认值 | | ------------- | -------------------------- | --------- | ------- | | position | 安全区的位置,可选值为 `top` `bottom` | _string_ | - | | nativeSafeTop | 是否启用顶部安全区域原生属性 | _boolean_ | `false` | --- url: https://taroify.com/components/fixed-view/index.md --- # FixedView 固定视图 ### 介绍 用于固定在顶部或底部的视图。 ## 代码演示 ### 基础用法 ```tsx 固定在顶部 固定在底部 ``` ## API ### Props | 参数 | 说明 | 类型 | 默认值 | | ------------- | ------------------------- | --------- | ------- | | position | 固定位置,可选值 `top` `bottom` | _string_ | - | | safeArea | 安全区域,可选值 `top` `bottom` | _string_ | - | | nativeSafeTop | 是否启用顶部安全区域原生属性 | _boolean_ | `false` | | placeholder | 固定在底部时,是否在标签位置生成一个等高的占位元素 | _boolean_ | - | --- url: https://taroify.com/components/cascader/index.md --- # Cascader 级联选择 ### 介绍 级联选择框,用于多层级数据的选择,典型场景为省市区选择。 ### 引入 ```tsx import { Cascader } from "@taroify/core" ``` ## 代码演示 ### 基础用法 级联选择组件可以搭配 Field 和 Popup 组件使用,示例如下: ```tsx import { Cascader, Field, Popup } from "@taroify/core" import { ArrowRight } from "@taroify/icons" import { useState } from "react" const dept = [ { label: "研发中心", value: "1", children: [ { label: "产线1", value: "1-1", children: [ { label: "研发", value: "1-1-1", }, { label: "测试", value: "1-1-2", }, { label: "产品", value: "1-1-3", }, ], }, { label: "产线2", value: "1-2", }, ], }, { label: "客户中心", value: "2", children: [ { label: "客服", value: "2-1", }, { label: "销售", value: "2-2", }, ], }, ] function BasicCascader() { const [open, setOpen] = useState(false) const [value, setValue] = useState([]) const [fieldValue, setFieldValue] = useState("") return ( <> setOpen(true)}> { setOpen(false) setFieldValue(options.map((item) => item.children).join("/")) }} /> ) } ``` ### 自定义颜色 通过 CSS 变量来设置选中状态的高亮颜色。 ```tsx ``` ```scss .custom-color { --tabs-active-color: red; --cascader-active-color: red; } ``` ### 标题栏与关闭按钮 v1.0.3 设置 `closeable` 后展示关闭按钮,点击时触发 `onClose`。通过 `closeIcon` 可以自定义关闭图标;通过 `showHeader={false}` 可以隐藏整个标题栏。 ```tsx import { Cross } from "@taroify/icons" } onClose={() => setOpen(false)} /> ``` ### 异步加载选项 通过 loadData 返回下一级的选项,返回空数组\[]时结束触发 onChange ```tsx export const dynamic = [ { label: "产品", value: "1", }, { label: "测试", value: "2", }, { label: "研发", value: "3", }, ] function DynamicCascader() { const [open, setOpen] = useState(false) const [value, setValue] = useState([]) const [fieldValue, setFieldValue] = useState("") return ( <> setOpen(true)}> { const len = _values_.length return new Promise((resolve) => { resolve( len > 3 ? [] : [ { label: `动态${len}-1`, value: Math.random() }, { label: `动态${len}-2`, value: Math.random() }, ], ) }) }} title="请选择" swipeable value={value} onSelect={setValue} onChange={(_values_, options) => { setOpen(false) setFieldValue(options.map((item) => item.children).join("/")) }} /> ) } ``` > Tips: 数据量大时,可关闭 animated,swipeable,避免卡顿 ### 自定义选项内容 v1.0.3 数据模式下可以通过 `renderOption` 自定义选项内容,通过 `renderOptionsTop` 和 `renderOptionsBottom` 在每一级选项的上方、下方插入内容。回调中的 `option` 和 `options` 均为传入的原始数据。 ```tsx import { View } from "@tarojs/components" ( {tabIndex + 1}. {option.label} )} renderOptionsTop={({ options, tabIndex }) => ( 第 {tabIndex + 1} 级,共 {options.length} 项 )} renderOptionsBottom={({ tabIndex }) => ( 已展示第 {tabIndex + 1} 级全部选项 )} /> ``` ### 自动定位选中项 v1.0.3 设置 `autoScrollToSelected` 后,切换标签时会自动将该级已选中的选项滚动到可视区域。该功能默认关闭, 不会改变已有页面的滚动行为。使用较长的同级选项列表可以直观看到定位效果。 ```tsx ``` ### 自定义字段名 ```tsx const fieldNames = { label: "name", value: "code", children: "data", } function CustomFieldCascader() { const [open, setOpen] = useState(false) const [value, setValue] = useState([]) const [fieldValue, setFieldValue] = useState("") return ( <> setOpen(true)}> { setOpen(false) setFieldValue(options.map((item) => item.children).join("/")) }} /> ) } ``` ### 手动控制 DOM 可以通过 `Cascader.Header`, `Cascader.Tab`, `Cascader.Option`,配合 `useCascader` 自己控制 DOM ```tsx import { Cascader, Field, Popup } from "@taroify/core" import { ArrowRight } from "@taroify/icons" import { useState } from "react" import { useCascader } from "@taroify/hooks" function BasicCascader() { const [open, setOpen] = useState(false) const [value, setValue] = useState([]) const [fieldValue, setFieldValue] = useState("") const { columns } = useCascader({ value, depth: 3, options: area }) return ( <> setOpen(true)}> { setOpen(false) setFieldValue(options.map((item) => item.children).join("/")) }} > 请选择所在地区 {columns.map((options, index) => ( {options.map((option) => ( {option.label} ))} ))} ) } ``` 通过改变 selected.children,同样可以动态加载选项 ```tsx const onSelect = (_value) => { const level = _value.length - 1 const selected = columns[level].find((item) => item.value === _value[level]) if (selected && level < depth - 1) { selected.children = [ { label: `动态${level}-1`, value: Math.random() }, { label: `动态${level}-2`, value: Math.random() }, ] } setValue(_value) } ``` ## API ### Cascader Props | 参数 | 说明 | 类型 | 默认值 | | ----------------------------------------- | --------------------------------- | -------------------------------------------------------------------------- | ---------------------------------------------------------- | | value | 选中项的值 | _string\[]_ | - | | placeholder | 未选中时的提示文案 | _ReactNode_ | `请选择` | | title | 顶部标题 | _ReactNode_ | - | | showHeader | 是否显示标题栏,未设置时根据标题、Header 或关闭按钮自动判断 | _boolean_ | - | | closeable | 是否显示关闭按钮 | _boolean_ | `false` | | closeIcon | 自定义关闭图标 | _ReactNode_ | `` | | swipeable | 是否开启手势左右滑动切换 | _boolean_ | `false` | | animated | 是否开启动过渡动画 | _boolean_ | `true` | | options | 可选项数据源 | _CascaderDataOption\[]_ | `[]` | | loadData | 动态加载数据 | _(values: string\[], options: CascaderEventOption\[]) => Promise\_ | - | | fieldNames | 自定义 options 结构中的字段 | _CascaderFieldNames_ | `{ label: 'label', value: 'value', children: 'children' }` | | ellipsis | 是否省略过长的标题文字 | _boolean_ | `true` | | autoScrollToSelected | 切换标签时是否自动定位该级选中项 | _boolean_ | `false` | | renderOption | 自定义数据模式下的选项内容 | _(props: CascaderOptionRenderProps) => ReactNode_ | - | | renderOptionsTop | 自定义每级选项列表上方内容 | _(props: CascaderOptionsRenderProps) => ReactNode_ | - | | renderOptionsBottom | 自定义每级选项列表下方内容 | _(props: CascaderOptionsRenderProps) => ReactNode_ | - | ### Cascader Events | 事件 | 说明 | 回调参数 | | ---------------------------- | ----------- | ------------------------------------------------- | | onSelect | 选中项变化时触发 | _values: any\[], options: CascaderEventOption\[]_ | | onChange | 全部选项选择完成后触发 | _values: any\[], options: CascaderEventOption\[]_ | | onTabClick | 点击标签时触发 | _event: Tabs.TabEvent_ | | onClose | 点击关闭按钮时触发 | _event: ITouchEvent_ | ### Cascader.Header Props | 参数 | 说明 | 类型 | 默认值 | | -------- | ---- | ---------- | --- | | children | 头部内容 | _ReactNoe_ | - | ### Cascader.Tab Props | 参数 | 说明 | 类型 | 默认值 | | -------- | ----- | ---------- | --- | | children | 子选项列表 | _ReactNoe_ | - | ### Cascader.Option Props | 参数 | 说明 | 类型 | 默认值 | | -------- | ---------- | ------------------ | ------- | | children | 选项内容(必填) | _ReactNoe_ | - | | value | 选项对应的值(必填) | _string \| number_ | - | | disabled | 是否禁用选项 | _boolean_ | `false` | ### 类型定义 通过`@taroify/core/cascader`导入类型 ```tsx import type { CascaderDataOption, CascaderEventOption, CascaderFieldNames, CascaderOptionRenderProps, CascaderOptionsRenderProps, } from "@taroify/core/cascader" ``` ## 主题定制 ### 样式变量 组件提供了下列 CSS 变量,可用于自定义样式,使用方法请参考 [ConfigProvider](/components/config-provider/index.md) 组件。 | 名称 | 默认值 | 描述 | | ------------------------------------------------ | ------------------------------- | -- | | --cascader-active-color | _var(--blue, $blue)_ | - | | --cascader-header-height | _48px \* $hd_ | - | | --cascader-header-padding | _0 var(--padding-md)_ | - | | --cascader-header-font-size | _var(--font-size-lg)_ | - | | --cascader-header-font-weight | _var(--font-weight-bold)_ | - | | --cascader-header-line-height | _20px \* $hd_ | - | | --cascader-close-icon-size | _22px \* $hd_ | - | | --cascader-close-icon-color | _var(--gray-5)_ | - | | --cascader-tabs-height | _48px \* $hd_ | - | | --cascader-tab-font-weight | _var(--font-weight-bold)_ | - | | --cascader-tab-color | _var(--text-color)_ | - | | --cascader-inactive-tab-color | _var(--gray-6)_ | - | | --cascader-options-height | _384px \* $hd_ | - | | --cascader-option-padding | _10px \* $hd var(--padding-md)_ | - | | --cascader-option-font-size | _var(--font-size-md)_ | - | | --cascader-option-line-height | _var(--line-height-md)_ | - | | --cascader-option-active-background-color | _var(--active-color)_ | - | | --cascader-disabled-option-color | _var(--gray-5)_ | - | | --cascader-active-option-color | _var(--cascader-active-color)_ | - | | --cascader-active-option-font-weight | _var(--font-weight-bold)_ | - | | --cascader-active-icon-font-size | _18px \* $hd_ | - | --- url: https://taroify.com/components/calendar/index.md --- # Calendar 日历 ### 介绍 日历组件用于选择日期或日期区间。如要以弹层形式展示, 请使用 poppable,不要手动嵌套 ### 引入 ```tsx import { Calendar } from "@taroify/core" ``` ## 代码演示 ### 选择单个日期 下面演示了结合单元格来使用日历组件的用法,日期选择完成后会触发 `onConfirm` 事件。 ```tsx function formatFullDate(date?: Date) { if (date) { return `${date.getFullYear()}/${formatDate(date)}` } } function SingleCalendar() { const [open, setOpen] = useState(false) const [value, setValue] = useState() const [formatValue, setFormatValue] = useState() return ( <> setOpen(true)} /> { setOpen(false) setFormatValue(formatFullDate(newValue)) }} > ) } ``` ### 选择多个日期 设置 `type` 为 `multiple` 后可以选择多个日期,此时 `onConfirm` 事件处理 value 数组结构,数组包含若干个选中的日期。 ```tsx function formatMultiple(dates: Date[]) { if (dates.length) { return `选择了 ${dates.length} 个日期` } } function MultipleCalendar() { const [open, setOpen] = useState(false) const [value, setValue] = useState() const [formatValue, setFormatValue] = useState() return ( <> setOpen(true)} /> { setFormatValue(formatMultiple(newValue)) setOpen(false) }} > ) } ``` ### 选择日期区间 设置 `type` 为 `range` 后可以选择日期区间,此时 `onConfirm` 事件处理 value 数组结构,数组第一项为开始时间,第二项为结束时间。 ```tsx function formatRange(dateRange: Date[]) { if (dateRange.length) { const [start, end] = dateRange return `${formatDate(start)} - ${formatDate(end)}` } } function RangeCalendar() { const [open, setOpen] = useState(false) const [value, setValue] = useState() const [formatValue, setFormatValue] = useState() return ( <> setOpen(true)} /> { setFormatValue(formatRange(newValue)) setOpen(false) }} > ) } ``` ### 快捷选择 将 `showConfirm` 设置为 `false` 可以隐藏确认按钮,这种情况下选择完成后会立即触发 confirm 事件。 ```tsx function SingleQuicklyCalendar() { const [open, setOpen] = useState(false) const [value, setValue] = useState() const [formatValue, setFormatValue] = useState() return ( <> setOpen(true)} /> { setFormatValue(formatFullDate(newValue)) setOpen(false) }} /> ) } ``` ### 自定义颜色 通过 `css` 可以自定义日历的颜色,对选中日期和底部按钮生效。 ```tsx ``` ### 自定义日期范围 通过 `min` 和 `max` 定义日历的范围。 ```tsx function CustomRangeCalendar() { const [minDate] = useState(new Date(2010, 0, 1)) const [maxDate] = useState(new Date(2010, 0, 31)) const [open, setOpen] = useState(false) const [value, setValue] = useState() const [formatValue, setFormatValue] = useState() return ( <> setOpen(true)} /> { setFormatValue(formatRange(newValue)) setOpen(false) }} > ) } ``` ### 自定义按钮文字 通过 `confirmText` 设置按钮文字,通过 `confirmDisabledText` 设置按钮禁用时的文字。 ```tsx function CustomConfirmCalendar() { const [open, setOpen] = useState(false) const [value, setValue] = useState() const [formatValue, setFormatValue] = useState() return ( <> setOpen(true)} /> { setValue(newValue) }} poppable showPopup={open} confirmDisabledText="请选择结束时间" onClose={setOpen} onConfirm={(newValue) => { setFormatValue(formatRange(newValue)) setOpen(false) }} > ) } ``` ### 自定义日期文案 通过传入 `formatter` 函数来对日历上每一格的内容进行格式化。 ```tsx const dayFormatter = (day: Calendar.DayObject) => { if (!day.value) { return day } const month = day.value.getMonth() + 1 const date = day.value.getDate() if (month === 5) { if (date === 1) { day.top = "劳动节" } else if (date === 4) { day.top = "青年节" } else if (date === 11) { day.children = "今天" } } if (day.type === "start") { day.bottom = "入店" } else if (day.type === "end") { day.bottom = "离店" } else if (day.type === "active") { day.bottom = "入店/离店" } return day } function CustomDayCalendar() { const [open, setOpen] = useState(false) const [minDate] = useState(new Date(2010, 4, 1)) const [maxDate] = useState(new Date(2010, 4, 31)) const [value, setValue] = useState() const [formatValue, setFormatValue] = useState() return ( <> setOpen(true)} /> { setFormatValue(formatRange(newValue)) setOpen(false) }} > ) } ``` ### 自定义弹出位置 通过 `placement` 属性自定义弹出层的弹出位置,可选值为 `top`、`left`、`right`。 ```tsx function CustomPositionCalendar() { const [open, setOpen] = useState(false) const [value, setValue] = useState() const [formatValue, setFormatValue] = useState() return ( <> setOpen(true)} /> { setFormatValue(formatFullDate(newValue)) setOpen(false) }} > ) } ``` ### 自定义周起始日 通过 `firstDayOfWeek` 属性设置一周从哪天开始。 ```tsx function CustomFirstDayOfWeekCalendar() { const [open, setOpen] = useState(false) const [value, setValue] = useState() const [formatValue, setFormatValue] = useState() return ( <> setOpen(true)} /> { setFormatValue(formatFullDate(newValue)) setOpen(false) }} > ) } ``` ### 平铺展示 将 `poppable` 设置为 `false`,日历会直接展示在页面内,而不是以弹层的形式出现。 ```tsx function TiledCalendar() { const [minDate] = useState(new Date(2012, 1, 10)) const [maxDate] = useState(new Date(2012, 10, 20)) const [value, setValue] = useState() return ( ) } ``` ### 手动控制 Footer DOM 通过 `Calendar.Footer` `Calendar.Button` 手动控制 Footer DOM。 ```tsx function CustomConfirmCalendar() { const [open, setOpen] = useState(false) const [value, setValue] = useState() const [confirm, setConfirm] = useState("请选择结束时间") const [formatValue, setFormatValue] = useState() return ( <> setOpen(true)} /> { setValue(newValue) setConfirm(newValue.length === 2 ? "完成" : "请选择结束时间") }} poppable showPopup={open} onClose={setOpen} onConfirm={(newValue) => { setFormatValue(formatRange(newValue)) setOpen(false) }} > {confirm} ) } ``` ## API ### Props | 参数 | 说明 | 类型 | 默认值 | | ------------------- | ----------------------------------------------------------------------- | ------------------------------------------------- | ------------------------------------------------------------- | | type | 选择类型:
`single` 表示选择单个日期,
`multiple` 表示选择多个日期,
`range` 表示选择日期区间 | _string_ | `single` | | defaultValue | 默认选中的日期,`type` 为 `multiple` 或 `range` 时为数组,传入 `null` 表示默认不选择 | _Date \| Date\[] \| null_ | 今天 | | value | 选中的日期,`type` 为 `multiple` 或 `range` 时为数组,传入 `null` 表示默认不选择 | _Date \| Date\[] \| null_ | 今天 | | formatter | 日期格式化函数 | _(day: Calendar.DayObject) => Calendar.DayObject_ | - | | title | 日历标题 | _ReactNode_ | `日期选择` | | showSubtitle | 是否展示日历副标题(年月) | _boolean_ | `true` | | subtitle | 自定义日历副标题 | _ReactNode\|((date: Date) => ReactNode)_ | (date) => \`$\{date.getFullYear()}年$\{date.getMonth() + 1}月\` | | watermark | 是否显示月份背景水印 | _boolean_ | `true` | | min | 可选择的最小日期 | _Date_ | 当前日期 | | max | 可选择的最大日期 | _Date_ | 当前日期的六个月后 | | poppable | 是否以弹层的形式展示日历 | _boolean_ | `false` | | showPopup | 是否显示日历弹窗, poppable: true 时生效 | _boolean_ | `false` | | popupPlacement | 弹出位置,可选值为 `left` `right` `top` , poppable: true 时生效 | _string_ | `bottom` | | popupRound | 是否显示圆角弹窗, poppable: true 时生效 | _boolean_ | `true` | | popupCloseIcon | 弹框是否显示关闭图标, poppable: true 时生效 | _boolean_ | `true` | | readonly | 是否为只读状态,只读状态下不能选择日期 | _boolean_ | `false` | | showConfirm | 是否展示确认按钮 | _boolean_ | `true` | | confirmText | 确认按钮的文字 | _ReactNode_ | `确认` | | confirmDisabledText | 确认按钮处于禁用状态时的文字 | _ReactNode_ | `确认` | | firstDayOfWeek | 设置周起始日 | _0-6_ | `0` | ### Calendar.DayObject 数据结构 日历中的每个日期都对应一个 Day 对象,通过`formatter`属性可以自定义 Day 对象的内容 | 键名 | 说明 | 类型 | | --------- | ---------------------------------------------------- | -------- | | value | 日期对应的 Date 对象 | _Date_ | | type | 日期类型,可选值为 `active` `start` `middle` `end` `disabled` | _string_ | | children | 中间显示的文字 | _string_ | | top | 上方的提示信息 | _string_ | | bottom | 下方的提示信息 | _string_ | | className | 额外类名 | _string_ | ### Events | 事件名 | 说明 | 回调参数 | | --------- | --------------------------------------------- | ------------------------ | | onChange | 点击并选中任意日期时触发 | _value: Date \| Date\[]_ | | onConfirm | 日期选择完成后触发,若使用 `Calendar.Button` 组件,则点击确认按钮后触发 | _value: Date \| Date\[]_ | | onClose | 关闭弹层时出发 | _visible: boolean_ | ### Calendar.Footer Props | 参数 | 说明 | 类型 | 默认值 | | -------- | ---- | ---------- | --- | | children | 底部内容 | _ReactNoe_ | - | ### Calendar.Button Props | 参数 | 说明 | 类型 | 默认值 | | ------------------- | -------------- | ----------- | --------- | | children | 按钮内容 | _ReactNoe_ | 确认 | | type | 按钮类型 | _confirm_ | `confirm` | | confirmText | 确认按钮的文字 | _ReactNode_ | - | | confirmDisabledText | 确认按钮处于禁用状态时的文字 | _ReactNode_ | - | ## 主题定制 ### 样式变量 组件提供了下列 CSS 变量,可用于自定义样式,使用方法请参考 [ConfigProvider](/components/config-provider/index.md) 组件。 | 名称 | 默认值 | 描述 | | ------------------------------------------ | ---------------------------------------------------- | -- | | --calendar-active-color | _var(--blue, $blue)_ | - | | --calendar-background-color | _var(--white)_ | - | | --calendar-header-box-shadow | _0 2px \* $hd 10px \* $hd rgba(125, 126, 128, 0.16)_ | - | | --calendar-header-title-height | _44px \* $hd_ | - | | --calendar-header-title-font-size | _var(--font-size-lg)_ | - | | --calendar-header-subtitle-font-size | _var(--font-size-md)_ | - | | --calendar-weekdays-height | _30px \* $hd_ | - | | --calendar-weekdays-font-size | _var(--font-size-sm)_ | - | | --calendar-month-title-font-size | _var(--font-size-md)_ | - | | --calendar-month-watermark-color | _rgba(242, 243, 245, 0.8)_ | - | | --calendar-month-watermark-font-size | _160px \* $hd_ | - | | --calendar-range-edge-color | _var(--white)_ | - | | --calendar-range-edge-background-color | _var(--calendar-active-color)_ | - | | --calendar-range-middle-color | _var(--calendar-active-color)_ | - | | --calendar-range-middle-background-opacity | _0.1_ | - | | --calendar-day-height | _64px \* $hd_ | - | | --calendar-day-font-size | _var(--font-size-lg)_ | - | | --calendar-day-disabled-color | _var(--gray-5)_ | - | | --calendar-active-day-size | _54px \* $hd_ | - | | --calendar-active-day-color | _var(--white)_ | - | | --calendar-active-day-background-color | _var(--calendar-active-color)_ | - | | --calendar-active-day-border-radius | _var(--border-radius-md)_ | - | | --calendar-day-info-font-size | _var(--font-size-xs)_ | - | | --calendar-day-info-line-height | _var(--line-height-xs)_ | - | | --calendar-confirm-button-height | _36px \* $hd_ | - | | --calendar-confirm-button-margin | _7px \* $hd 0_ | - | | --calendar-confirm-button-color | _var(--calendar-active-color)_ | - | | --calendar-footer-padding | _0 var(--padding-md)_ | - | --- url: https://taroify.com/components/checkbox/index.md --- # Checkbox 复选框 ### 介绍 在一组备选项中进行多选。 ### 引入 ```tsx import { Checkbox } from "@taroify/core" ``` ## 代码演示 ### 基础用法 通过 `checked` 绑定复选框的勾选状态。 ```tsx 复选框 ``` ### 禁用状态 通过设置 `disabled` 属性可以禁用复选框。 ```tsx 复选框 复选框 ``` ### 自定义形状 将 `shape` 属性设置为 `square`,复选框的形状会变成方形。 ```tsx 自定义形状 ``` ### 按钮形状 将 `shape` 属性设置为 `button`,复选框会变成适合规格选择等场景的按钮。按钮形状下,`icon` 和 `size` 属性不生效。 ```tsx 复选框 a 复选框 b ``` ### 自定义颜色 通过 `css` 设置选中状态的图标颜色。 ```tsx 自定义颜色 ``` ```scss .custom-color { --checkbox-checked-icon-border-color: #ee0a24; --checkbox-checked-icon-background-color: #ee0a24; } ``` ### 自定义大小 通过 `size` 属性可以自定义图标的大小。 ```tsx 自定义大小 ``` ### 自定义图标 通过 `icon` 属性自定义图标。 ```tsx function CheckboxWithCustomIcon() { const [value, setValue] = useState(false) return ( } checked={value} onChange={setValue} > 自定义图标 ) } ``` ### 复选框组 复选框可以与复选框组一起使用,复选框组通过 `value` 数组绑定复选框的勾选状态。 ```tsx 复选框 a 复选框 b ``` ### 水平排列 将 `direction` 属性设置为 `horizontal` 后,复选框组会变成水平排列。 ```tsx 复选框 a 复选框 b ``` ### 限制最大可选数 通过 `max` 属性可以限制复选框组的最大可选数。 ```tsx 复选框 a 复选框 b 复选框 c ``` ### 搭配单元格组件使用 此时你需要再引入 `Cell` 和 `Cell.Group` 组件,并通过 `Checkbox` 实例上的 toggle 方法触发切换。 ```tsx ``` ## API ### Checkbox Props | 参数 | 说明 | 类型 | 默认值 | | -------------------------- | ------------------------- | ------------------ | ------- | | defaultChecked | 默认是否为选中状态 | _boolean_ | `false` | | checked | 是否为选中状态 | _boolean_ | `false` | | name | 标识符 | _any_ | - | | shape | 形状,可选值为 `square` `button` | _string_ | `round` | | disabled | 是否禁用复选框 | _boolean_ | `false` | | size | 图标大小,默认单位为 `px` | _number \| string_ | `20px` | ### CheckboxGroup Props | 参数 | 说明 | 类型 | 默认值 | | ------------ | ---------------------- | ------------------ | ---------- | | defaultValue | 默认所有选中项的标识符 | _any\[]_ | - | | value | 所有选中项的标识符 | _any\[]_ | - | | disabled | 是否禁用所有复选框 | _boolean_ | `false` | | max | 最大可选数,`0` 为无限制 | _number \| string_ | `0` | | direction | 排列方向,可选值为 `horizontal` | _string_ | `vertical` | | size | 所有复选框的图标大小,默认单位为 `px` | _number \| string_ | `20px` | ### Checkbox Events | 事件名 | 说明 | 回调参数 | | -------- | ------------ | ------------------ | | onChange | 当绑定值变化时触发的事件 | _checked: boolean_ | ### CheckboxGroup Events | 事件名 | 说明 | 回调参数 | | -------- | ------------ | --------------- | | onChange | 当绑定值变化时触发的事件 | _names: any\[]_ | ## 主题定制 ### 样式变量 组件提供了下列 CSS 变量,可用于自定义样式,使用方法请参考 [ConfigProvider](/components/config-provider/index.md) 组件。 | 名称 | 默认值 | 描述 | | --------------------------------------------------------------- | ----------------------------------------- | -- | | --checkbox-size | _20px \* $hd_ | - | | --checkbox-font-size | _var(--font-size-lg)_ | - | | --checkbox-border-color | _var(--gray-5)_ | - | | --checkbox-transition-duration | _var(--animation-duration-fast)_ | - | | --checkbox-gap | _var(--padding-sm)_ | - | | --checkbox-label-margin | _var(--padding-xs)_ | - | | --checkbox-label-color | _var(--text-color)_ | - | | --checkbox-label-line-height | _var(--checkbox-size)_ | - | | --checkbox-disabled-label-color | _var(--gray-5)_ | - | | --checkbox-icon-font-size | _var(--checkbox-size)_ | - | | --checkbox-checked-icon-color | _var(--white)_ | - | | --checkbox-checked-icon-border-color | _var(--primary-color)_ | - | | --checkbox-checked-icon-background-color | _var(--primary-color)_ | - | | --checkbox-disabled-icon-color | _var(--gray-5)_ | - | | --checkbox-disabled-icon-border-color | _var(--gray-5)_ | - | | --checkbox-disabled-icon-background-color | _var(--border-color)_ | - | | --checkbox-button-padding | _5px \* $hd 18px \* $hd_ | - | | --checkbox-button-border-radius | _var(--border-radius-max)_ | - | | --checkbox-button-color | _var(--text-color)_ | - | | --checkbox-button-background-color | _var(--gray-1)_ | - | | --checkbox-button-border-color | _var(--checkbox-button-background-color)_ | - | | --checkbox-button-checked-color | _var(--primary-color)_ | - | | --checkbox-button-checked-background-color | _var(--white)_ | - | | --checkbox-button-checked-border-color | _var(--primary-color)_ | - | | --checkbox-button-disabled-opacity | _var(--disabled-opacity)_ | - | --- url: https://taroify.com/components/field/index.md --- # Field 输入框 ### 介绍 用户可以在文本框内输入或编辑文字。 ### 引入 ```tsx import { Field } from "@taroify/core" ``` ## 代码演示 ### 基础用法 可以通过 `value` 设置输入框的值,通过 `placeholder` 设置占位提示文字,通过 `onChange` 事件获得改变的值。 ```tsx import { Cell, Field, Input } from "@taroify/core" function BasicField() { const [value, setValue] = useState("") return ( setValue(e.detail.value)} /> ) } ``` ### 自定义类型 根据 `type` 属性定义不同类型的输入框,默认值为 `text`。 ```tsx import { Cell, Field, Input } from "@taroify/core" function CustomField() { const [text, setText] = useState("") const [idcard, setIdcard] = useState("") const [number, setNumber] = useState("") const [digit, setDigit] = useState("") const [password, setPassword] = useState("") return ( setText(e.detail.value)} /> setIdcard(e.detail.value)} /> setNumber(e.detail.value)} /> setDigit(e.detail.value)} /> setPassword(e.detail.value)} /> ) } ``` ### 禁用输入框 通过 `readonly` 将输入框设置为只读状态,通过 `disabled` 将输入框设置为禁用状态。 ```tsx import { Cell, Field, Input } from "@taroify/core" function DisabledField() { return ( ) } ``` ### 显示图标 通过 `icon` 和 `rightIcon` 配置输入框两侧的图标,通过设置 `clearable` 在输入过程中展示清除图标。 ```tsx import { Cell, Field, Input } from "@taroify/core" function IconField() { return ( } rightIcon={}> }> ) } ``` ### 错误提示 设置 `required` 属性表示这是一个必填项,可以配合 `Input` 或 `Field.Feedback` 组件显示对应的错误提示。 ```tsx import { Cell, Field, Input } from "@taroify/core" function ErrorField() { return ( 手机号格式错误} > ) } ``` ### 插入按钮 通过 `Button` 可以在输入框尾部插入按钮。 ```tsx import { Cell, Field, Input } from "@taroify/core" function ButtonField() { return ( ) } ``` ### 高度自适应 对于 Textarea 组件,可以通过 `autoHeight` 属性设置高度自适应。 ```tsx import { Cell, Field, Textarea } from "@taroify/core" import { getEnv } from "@tarojs/taro" const env = getEnv(); function FieldWithTextarea() { return (