forked from jdf2e/nutui-react
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(pagination): demo拆解与规范 (jdf2e#2079)
- Loading branch information
1 parent
e3d094a
commit b7a5f87
Showing
18 changed files
with
314 additions
and
728 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
import React, { useState } from 'react' | ||
import { Pagination } from '@nutui/nutui-react' | ||
|
||
const Demo1 = () => { | ||
const [currentPage1, setCurrentPage1] = useState(1) | ||
const pageChange1 = (v: number) => { | ||
const c = v | ||
setCurrentPage1(c) | ||
} | ||
return ( | ||
<Pagination | ||
value={currentPage1} | ||
total={20} | ||
pageSize={5} | ||
onChange={pageChange1} | ||
/> | ||
) | ||
} | ||
export default Demo1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import React, { useState } from 'react' | ||
import { Pagination } from '@nutui/nutui-react' | ||
|
||
const Demo2 = () => { | ||
const [currentPage2, setCurrentPage2] = useState(1) | ||
const pageChange2 = (v: number) => { | ||
const c = v | ||
setCurrentPage2(c) | ||
} | ||
return ( | ||
<Pagination | ||
value={currentPage2} | ||
total={12} | ||
pageSize={1} | ||
mode="simple" | ||
onChange={pageChange2} | ||
/> | ||
) | ||
} | ||
export default Demo2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import React, { useState } from 'react' | ||
import { Pagination } from '@nutui/nutui-react' | ||
|
||
const Demo3 = () => { | ||
const [currentPage2, setCurrentPage2] = useState(1) | ||
const pageChange2 = (v: number) => { | ||
const c = v | ||
setCurrentPage2(c) | ||
} | ||
return ( | ||
<Pagination | ||
value={currentPage2} | ||
total={12} | ||
pageSize={1} | ||
mode="lite" | ||
onChange={pageChange2} | ||
/> | ||
) | ||
} | ||
export default Demo3 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import React, { useState } from 'react' | ||
import { Pagination } from '@nutui/nutui-react' | ||
|
||
const Demo4 = () => { | ||
const [currentPage3, setCurrentPage3] = useState(1) | ||
const pageChange3 = (v: number) => { | ||
const c = v | ||
setCurrentPage3(c) | ||
} | ||
return ( | ||
<Pagination | ||
value={currentPage3} | ||
total={125} | ||
itemSize={2} | ||
ellipse | ||
onChange={pageChange3} | ||
/> | ||
) | ||
} | ||
export default Demo4 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
import React, { useState } from 'react' | ||
import { Pagination } from '@nutui/nutui-react' | ||
import { ArrowLeft, ArrowRight } from '@nutui/icons-react' | ||
|
||
const Demo5 = () => { | ||
const [currentPage4, setCurrentPage4] = useState(1) | ||
const pageChange4 = (v: number) => { | ||
const c = v | ||
setCurrentPage4(c) | ||
} | ||
const itemRender = (page: any) => { | ||
return <div>{page.number === 3 ? 'hot' : page.text}</div> | ||
} | ||
return ( | ||
<Pagination | ||
value={currentPage4} | ||
total={500} | ||
itemSize={5} | ||
onChange={pageChange4} | ||
itemRender={itemRender} | ||
prev={<ArrowLeft />} | ||
next={<ArrowRight />} | ||
/> | ||
) | ||
} | ||
export default Demo5 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import React from 'react' | ||
import { Pagination } from '@nutui/nutui-react' | ||
|
||
const Demo6 = () => { | ||
const pageChange5 = (v: number) => { | ||
console.log(v) | ||
} | ||
return ( | ||
<Pagination | ||
defaultValue={15} | ||
total={500} | ||
pageSize={10} | ||
itemSize={3} | ||
onChange={pageChange5} | ||
/> | ||
) | ||
} | ||
export default Demo6 |
Oops, something went wrong.