Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add page changing handler to QPagination stories #146

Merged
merged 2 commits into from
Sep 1, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 12 additions & 3 deletions stories/components/QPagination.stories.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import type { Meta, Story } from '@storybook/vue3';
import { defineComponent } from 'vue';
import { defineComponent, ref } from 'vue';

import QPagination from '@/qComponents/QPagination';
import type { QPaginationProps } from '@/qComponents/QPagination';
Expand All @@ -13,17 +13,26 @@ const QPaginationStory: Story<QPaginationProps> = args =>
defineComponent({
components: { QPagination },
setup() {
return { args };
const currentPage = ref<number>(args.currentPage);

const handlePageChange = (value: number): void => {
// eslint-disable-next-line no-console
console.log('current-change', value);
currentPage.value = value;
};

return { args, currentPage, handlePageChange };
},

template: `
<q-pagination
:page-count="args.pageCount"
:total="args.total"
:page-size="args.pageSize"
:current-page="args.currentPage"
:current-page="currentPage"
:disabled="args.disabled"
:pager-count="args.pagerCount"
@current-change="handlePageChange"
/>
`
});
Expand Down