@@ -88,26 +88,26 @@ import { ref } from 'vue';
88
88
const id = ref(1);
89
89
90
90
// Function without arguments
91
- const { data: dataList, pending: listPending , error: listError } = wrappedService.fetchData();
91
+ const { data: dataList, status: listStatus , error: listError } = wrappedService.fetchData();
92
92
93
93
// Function with arguments
94
- const { data: itemData, pending: itemPending , error: itemError } = wrappedService.getItem(() => [id.value]);
94
+ const { data: itemData, status: itemStatus , error: itemError } = wrappedService.getItem(() => [id.value]);
95
95
96
96
// Reactivity: when id.value changes, itemData updates automatically
97
97
</script>
98
98
99
99
<template>
100
100
<div>
101
101
<h1>Data List</h1>
102
- <div v-if="listPending ">Loading...</div>
102
+ <div v-if="listStatus === 'pending' ">Loading...</div>
103
103
<div v-else-if="listError">Error: {{ listError.message }}</div>
104
104
<div v-else>
105
105
<pre>{{ dataList }}</pre>
106
106
</div>
107
107
108
108
<h1>Item Data (ID: {{ id }})</h1>
109
109
<input v-model="id" type="number" min="1" />
110
- <div v-if="itemPending ">Loading...</div>
110
+ <div v-if="itemStatus === 'pending' ">Loading...</div>
111
111
<div v-else-if="itemError">Error: {{ itemError.message }}</div>
112
112
<div v-else>
113
113
<pre>{{ itemData }}</pre>
@@ -160,7 +160,7 @@ async function fetchData() {
160
160
const wrappedService = useAsyncDataWrapper ({ fetchData });
161
161
162
162
// Use in a component
163
- const { data, pending , error } = wrappedService .fetchData ();
163
+ const { data, status , error } = wrappedService .fetchData ();
164
164
```
165
165
166
166
### Function With Arguments
@@ -179,7 +179,7 @@ import { ref } from 'vue';
179
179
180
180
const id = ref (1 );
181
181
182
- const { data, pending , error } = wrappedService .getItem (() => [id .value ]);
182
+ const { data, status , error } = wrappedService .getItem (() => [id .value ]);
183
183
184
184
// When id.value changes, data is automatically refreshed
185
185
```
@@ -193,7 +193,7 @@ You can pass options to `useAsyncData` through the wrapped functions to control
193
193
### Example with Options
194
194
195
195
``` typescript
196
- const { data, pending , error } = wrappedService .fetchData ({
196
+ const { data, status , error } = wrappedService .fetchData ({
197
197
lazy: true ,
198
198
server: false ,
199
199
default : () => [],
0 commit comments