-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
docs: add solidjs examples, optimize docs
- Loading branch information
Showing
29 changed files
with
1,171 additions
and
368 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -14,11 +14,11 @@ import useRequestSolid from '!!raw-loader!@site/codesandbox@3/01-getting-started | |
|
||
Next, we will learn how to use it in conjunction with the client UI framework, which can allow alova to exert its true power. When used in the UI framework, not only can alova automatically manage the responsive request status, but also automatically control when the request should be sent through certain rules. | ||
|
||
`alova` provides 10+ client request strategies, which help you implement complex requests in a simple and elegant way. Let's continue to look down! | ||
`alova` provides 15+ client request strategies, which help you implement complex requests in a simple and elegant way. Let's continue to look down! | ||
|
||
## Set statesHook | ||
|
||
Before using the request strategy, we need to set the corresponding statesHook on the alova instance. It must correspond to the UI framework used by the project. This is very important. It will tell alova that it should create responsive states for the corresponding UI framework. Currently, the following frameworks are supported: | ||
Alova's useHook request strategy can run in all UI frameworks supported by Alova. You only need to set the statesHook of the corresponding UI framework on the Alova instance, which will tell Alova which UI framework should be used to create states. | ||
|
||
<Tabs groupId="framework"> | ||
|
||
|
@@ -82,9 +82,29 @@ export const alovaInstance = createAlova({ | |
}); | ||
``` | ||
|
||
</TabItem> | ||
<TabItem value="5" label="vue-demi"> | ||
|
||
```js | ||
import { createAlova } from 'alova'; | ||
import VueDemiHook from 'alova/vue-demi'; | ||
|
||
// support [email protected]+ composition api | ||
export const alovaInstance = createAlova({ | ||
// ... | ||
// highlight-start | ||
statesHook: VueDemiHook | ||
// highlight-end | ||
}); | ||
``` | ||
|
||
</TabItem> | ||
</Tabs> | ||
|
||
In addition, alova also provides the following statesHooks: | ||
|
||
- [statesHook for vue options style](/resource/framework/vue-options), which means you can use alova's usehooks in vue2's options style components. | ||
|
||
## Automatically manage request status | ||
|
||
`useRequest` is our most commonly used request strategy. It can help us create and maintain responsive states of requests, such as `loading/data/error`, etc. You can use these responsive states directly in the view. When they change, the view will also change accordingly. | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.