@kikiloaw/simple-table 1.1.8 → 1.1.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +3 -3
- package/package.json +1 -1
- package/src/SimpleTable.vue +7 -2
package/README.md
CHANGED
|
@@ -1417,9 +1417,9 @@ tableRef.value?.refresh()
|
|
|
1417
1417
|
|
|
1418
1418
|
| Method | Parameters | Description |
|
|
1419
1419
|
|--------|------------|-------------|
|
|
1420
|
-
| `refresh()` | None | Resets
|
|
1421
|
-
| `fetchData(params)` | `params
|
|
1422
|
-
| `clearCache()` |
|
|
1420
|
+
| `refresh()` | None | **Resets to Page 1** and refetches data. Use for "Reset" actions. |
|
|
1421
|
+
| `fetchData(params)` | `params?: Object` | Refetches **current page** (if no params). Pass params to override (e.g. `{ page: 1 }`). |
|
|
1422
|
+
| `clearCache(scope)` | `scope?: 'all' \| 'current'` | Clears cache. Default `'all'` clears everything. Pass `'current'` to clear only active page state. |
|
|
1423
1423
|
|
|
1424
1424
|
---
|
|
1425
1425
|
|
package/package.json
CHANGED
package/src/SimpleTable.vue
CHANGED
|
@@ -194,8 +194,13 @@ function getCacheKey(): string {
|
|
|
194
194
|
})
|
|
195
195
|
}
|
|
196
196
|
|
|
197
|
-
function clearCache() {
|
|
198
|
-
|
|
197
|
+
function clearCache(scope: 'all' | 'current' = 'all') {
|
|
198
|
+
if (scope === 'current') {
|
|
199
|
+
const key = getCacheKey()
|
|
200
|
+
responseCache.value.delete(key)
|
|
201
|
+
} else {
|
|
202
|
+
responseCache.value.clear()
|
|
203
|
+
}
|
|
199
204
|
}
|
|
200
205
|
|
|
201
206
|
// Internal data state to handle both props updates and ajax updates
|