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

current miss match the hightlight after reload the page #1

Open
Arstman opened this issue Dec 20, 2020 · 2 comments
Open

current miss match the hightlight after reload the page #1

Arstman opened this issue Dec 20, 2020 · 2 comments

Comments

@Arstman
Copy link

Arstman commented Dec 20, 2020

hi, thanks for the good component, it works very great, however i found a tiny issue,

when i use together with svelte-spa-router, say i have a page like "sample.com/#/page/1", which i set current equal to the page num initially,

let current = params.page 

async function changePage(evt) {
        current = evt.detail;

        await getPageItems(current );
    }

it works fine, but when i refresh the page, the current not change, same as page num, the hightlight should stay same, but no matter what page num and current is, after reload the page the hightligh back to 1.

is there anything i do wrong here?

@haynajjar
Copy link
Contributor

Since the page param from the url is a string, i think you need to convert it into an integer using parseInt :

<Pagination ... current={parseInt(pageParam)} />

@Makohan
Copy link

Makohan commented Jan 28, 2021

If response data has page, you'll can get it.

let response;
$: current = response.page;

async function changePage(evt) {
  response = await getPageItems(evt.detail);
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants