Skip to content

Commit

Permalink
refactor(tables): Load on mount
Browse files Browse the repository at this point in the history
  • Loading branch information
sfxcode committed Apr 26, 2022
1 parent d51faeb commit 7a7a8eb
Show file tree
Hide file tree
Showing 4 changed files with 254 additions and 257 deletions.
16 changes: 8 additions & 8 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "nuxt3-primevue-starter",
"version": "1.0.0",
"version": "1.0.1",
"license": "MIT",
"private": true,
"scripts": {
Expand All @@ -21,23 +21,23 @@
"vue-logger-plugin": "^2.2.2"
},
"devDependencies": {
"@antfu/eslint-config": "^0.20.7",
"@antfu/eslint-config": "^0.21.1",
"@iconify-json/carbon": "^1.1.3",
"@iconify-json/twemoji": "^1.1.3",
"@iconify-json/mdi": "^1.1.9",
"@iconify-json/prime": "^1.1.1",
"@nuxt/test-utils-edge": "^3.0.0-rc.1-27510703.46ecbc5",
"@iconify-json/twemoji": "^1.1.3",
"@nuxt/test-utils-edge": "^3.0.0-rc.1-27515112.2d202b5",
"@nuxtjs/color-mode": "^3.0.2",
"@pinia/nuxt": "^0.1.8",
"@unocss/nuxt": "^0.31.13",
"@unocss/nuxt": "^0.31.16",
"@vitejs/plugin-vue": "^2.3.1",
"@vitest/ui": "^0.9.4",
"@vitest/ui": "^0.10.0",
"@vueuse/nuxt": "^8.3.1",
"c8": "^7.11.2",
"eslint": "^8.14.0",
"nuxt": "^3.0.0-rc.1",
"sass": "^1.50.1",
"sass": "^1.51.0",
"typescript": "^4.6.3",
"vitest": "^0.9.4"
"vitest": "^0.10.0"
}
}
9 changes: 3 additions & 6 deletions pages/prime/table.vue
Original file line number Diff line number Diff line change
Expand Up @@ -38,19 +38,15 @@

</template>
</DataTable>

<Button class="mt-6" label="Update Products" @click="update"/>
</div>
</template>

<script setup lang='ts'>
import {useDataStore} from '~/stores/data';
import {FilterMatchMode} from 'primevue/api';
import {useDataTable} from "~/composables/primevue/dataTable";
import {useLogger} from "vue-logger-plugin";
const log = useLogger();
const dataStore = useDataStore();
const {tableData, filters, dataTableRef, exportCSV} = useDataTable();
filters.value = {
Expand All @@ -68,9 +64,10 @@ watch(products, (newProducts) => {
tableData.value = newProducts.data
})
const update = () => {
onMounted(async () => {
refreshProducts();
}
});
</script>

Expand Down
2 changes: 1 addition & 1 deletion pages/stores.vue
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
</div>

<h5 class='font-bold text-2xl mb-4 text-blue-600'>Data Store</h5>
<span class='text-xs'>Example of a Cached Pinia Store, data is cached in local storage ...</span>
<span class='text-xs'>Example of a Data Store</span>
<div class='grid grid-cols-2 mt-6 gap-4'>
<div>Customers</div>
<div>{{ dataStore.customers.length }}</div>
Expand Down
Loading

0 comments on commit 7a7a8eb

Please sign in to comment.