getCards
Returns the raw, unfiltered card array in the order it was provided. This is the persistence snapshot - filters and sorting don't affect it. Use it when you need to serialize the full card set to a backend or local storage.
Usage
getCards(): KanbanCard[]
The method returns the same array that the internal CardsStore holds. It reflects every mutation made through actions (add-card, update-card, move-card, delete-card, duplicate-card) but ignores active filters and sort criteria. The result is not reactive - it's a snapshot at the time of the call.
Example
<script setup>
import { ref } from "vue";
import { Kanban } from "@svar-ui/vue-kanban";
const api = ref(null);
function saveToServer() {
const cards = api.value.getCards();
fetch("/api/cards", {
method: "PUT",
headers: { "Content-Type": "application/json" },
body: JSON.stringify(cards),
});
}
</script>
<template>
<button :onclick="saveToServer">Save</button>
<Kanban ref="api" :cards="cards" :columns="columns" />
</template>
Related
- cards - the initial card array prop
- getState - full state snapshot including viewData
- export-data - export visible board (filtered view)