Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork38
innocces/taro-hooks
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
V2 |V1
- Fully matched Taro
- Extending common hooks with ahooks
- Separate abstraction useRequest
- Complete type tips
- Extended h5 missing apis
# npm$ npm i taro-hooks# yarn$ yarn add taro-hooks# pnpm$ pnpm add taro-hooks
We use plugins for extending different frameworks. So you need to install the corresponding plugins according to the framework you are currently using
- React/PReact/Nerv
# npm$ npm i @taro-hooks/plugin-react# yarn$ yarn add @taro-hooks/plugin-react# pnpm$ pnpm add @taro-hooks/plugin-react
// config/index.jsmodule.exports={// ...plugins:['@taro-hooks/plugin-react'],// ...};
- Vue3
# npm$ npm i @taro-hooks/plugin-vue# yarn$ yarn add @taro-hooks/plugin-vue# pnpm$ pnpm add @taro-hooks/plugin-vue
// config/index.jsmodule.exports={// ...plugins:['@taro-hooks/plugin-vue'],// ...};
- React/PReact/Nerv
import{useEnv}from'taro-hooks';functionIndex(){constenv=useEnv();return<View>current env:{env}</View>;}
- Vue3
<template><view>current env: {{env}}</view></template><scriptsetuplang="ts">import{useEnv}from'taro-hooks';constenv=useEnv();</script>
We provide the @taro-hooks/plugin-auto-import plugin to help you quickly use theunplugin-auto-import capability.
# npm$ npm i @taro-hooks/plugin-auto-import# yarn$ yarn add @taro-hooks/plugin-auto-import# pnpm$ pnpm add @taro-hooks/plugin-auto-import
// config/index.jsconstconfig={// ...// The main prerequisite is that you have installed the plugin for the corresponding framework.plugins:[// If you are using vue3, please install the @taro-hooks/plugin-vue plugin beforehand.'@taro-hooks/plugin-vue',// If using React/PReact/Nerv, please pre-install the @taro-hooks/plugin-react plugin.'@taro-hooks/plugin-react',// Finally, the auto-import plugin is configured['@taro-hooks/plugin-auto-import',{// your options, see configuration: https://github.com/antfu/unplugin-auto-import#configuration}]],// ...};
- React/PReact/Nerv
functionIndex(){constenv=useEnv();return<View>current env:{env}</View>;}
- Vue3
<template><view>current env: {{env}}</view></template><scriptsetuplang="ts">constenv=useEnv();</script>
packages | downloads | version | license |
---|---|---|---|
innocces 💬📖👀📢🤔 | ryan 📖📢🤔💻 |
MIT.
About
Hooks Library for Taro
Topics
Resources
License
Uh oh!
There was an error while loading.Please reload this page.
Stars
Watchers
Forks
Sponsor this project
Uh oh!
There was an error while loading.Please reload this page.
Contributors6
Uh oh!
There was an error while loading.Please reload this page.