Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
monorepo
/
venus
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
1
Merge Requests
0
Pipelines
Wiki
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit d6f239c5
authored
Mar 31, 2025
by
Netfan
Committed by
GitHub
Mar 31, 2025
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
docs: fix api-component demo link (#5828)
1 parent
166e9a0e
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
1 additions
and
1 deletions
docs/src/components/common-ui/vben-api-component.md
docs/src/components/common-ui/vben-api-component.md
View file @
d6f239c
...
@@ -125,7 +125,7 @@ function fetchApi(): Promise<Record<string, any>> {
...
@@ -125,7 +125,7 @@ function fetchApi(): Promise<Record<string, any>> {
## 并发和缓存
## 并发和缓存
有些场景下可能需要使用多个ApiComponent,它们使用了相同的远程数据源(例如用在可编辑的表格中)。如果直接将请求后端接口的函数传递给api属性,则每一个实例都会访问一次接口,这会造成资源浪费,是完全没有必要的。Tanstack Query提供了并发控制、缓存、重试等诸多特性,我们可以将接口请求函数用useQuery包装一下再传递给ApiComponent,这样的话无论页面有多少个使用相同数据源的ApiComponent实例,都只会发起一次远程请求。演示效果请参考
[
Playground vue-query
](
http
://localhost:5555
/demos/features/vue-query
)
,具体代码请查看项目文件
[
concurrency-caching
](
https://github.com/vbenjs/vue-vben-admin/blob/main/playground/src/views/demos/features/vue-query/concurrency-caching.vue
)
有些场景下可能需要使用多个ApiComponent,它们使用了相同的远程数据源(例如用在可编辑的表格中)。如果直接将请求后端接口的函数传递给api属性,则每一个实例都会访问一次接口,这会造成资源浪费,是完全没有必要的。Tanstack Query提供了并发控制、缓存、重试等诸多特性,我们可以将接口请求函数用useQuery包装一下再传递给ApiComponent,这样的话无论页面有多少个使用相同数据源的ApiComponent实例,都只会发起一次远程请求。演示效果请参考
[
Playground vue-query
](
http
s://www.vben.pro/#
/demos/features/vue-query
)
,具体代码请查看项目文件
[
concurrency-caching
](
https://github.com/vbenjs/vue-vben-admin/blob/main/playground/src/views/demos/features/vue-query/concurrency-caching.vue
)
## API
## API
...
...
Write
Preview
Markdown
is supported
Attach a file
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to post a comment