-
Notifications
You must be signed in to change notification settings - Fork 835
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore(pagination): split demo (#2765)
- Loading branch information
Showing
14 changed files
with
169 additions
and
291 deletions.
There are no files selected for viewing
10 changes: 10 additions & 0 deletions
10
packages/nutui-taro-demo/src/nav/pages/pagination/basic.vue
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,10 @@ | ||
<template> | ||
<nut-pagination v-model="page" :total-items="25" :items-per-page="5" @change="change" /> | ||
</template> | ||
<script setup lang="ts"> | ||
import { ref } from 'vue'; | ||
const page = ref(1); | ||
const change = (value: number) => { | ||
console.log(value); | ||
}; | ||
</script> |
16 changes: 16 additions & 0 deletions
16
packages/nutui-taro-demo/src/nav/pages/pagination/custom.vue
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,16 @@ | ||
<template> | ||
<nut-pagination v-model="page" :total-items="500" :show-page-size="5"> | ||
<template #prev-text> | ||
<Left width="10px" height="10px" /> | ||
</template> | ||
<template #next-text> | ||
<Right width="10px" height="10px" /> | ||
</template> | ||
<template #page="{ item }"> {{ item.number == 3 ? 'hot' : item.text }} </template> | ||
</nut-pagination> | ||
</template> | ||
<script setup lang="ts"> | ||
import { Left, Right } from '@nutui/icons-vue'; | ||
import { ref } from 'vue'; | ||
const page = ref(1); | ||
</script> |
7 changes: 7 additions & 0 deletions
7
packages/nutui-taro-demo/src/nav/pages/pagination/ellipse.vue
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,7 @@ | ||
<template> | ||
<nut-pagination v-model="page" :total-items="125" :show-page-size="3" force-ellipses /> | ||
</template> | ||
<script setup lang="ts"> | ||
import { ref } from 'vue'; | ||
const page = ref(1); | ||
</script> |
58 changes: 31 additions & 27 deletions
58
packages/nutui-taro-demo/src/nav/pages/pagination/index.vue
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 |
---|---|---|
@@ -1,34 +1,38 @@ | ||
<template> | ||
<Demo> | ||
<h2>基础用法</h2> | ||
<nut-pagination v-model="currentPage" :total-items="25" :items-per-page="5" @change="pageChange" /> | ||
<h2>简单模式</h2> | ||
<nut-pagination v-model="currentPage1" :page-count="12" mode="simple" @change="pageChange" /> | ||
<h2>显示省略号</h2> | ||
<nut-pagination v-model="currentPage2" :total-items="125" :show-page-size="3" force-ellipses @change="pageChange" /> | ||
<h2>自定义按钮</h2> | ||
<nut-pagination v-model="currentPage3" :total-items="500" :show-page-size="5" @change="pageChange"> | ||
<template #prev-text> | ||
<Left size="10px" /> | ||
</template> | ||
<template #next-text> | ||
<Right size="10px" /> | ||
</template> | ||
<template #page="{ item }"> | ||
{{ item.number == 3 ? 'hot' : item.text }} | ||
</template> | ||
</nut-pagination> | ||
<h2>{{ t('basic') }}</h2> | ||
<Basic /> | ||
|
||
<h2>{{ t('simple') }}</h2> | ||
<Simple /> | ||
|
||
<h2>{{ t('ellipse') }}</h2> | ||
<Ellipse /> | ||
|
||
<h2>{{ t('custom') }}</h2> | ||
<Custom /> | ||
</Demo> | ||
</template> | ||
|
||
<script setup lang="ts"> | ||
import { Left, Right } from '@nutui/icons-vue-taro'; | ||
import { ref } from 'vue'; | ||
const currentPage = ref(1); | ||
const currentPage1 = ref(1); | ||
const currentPage2 = ref(1); | ||
const currentPage3 = ref(1); | ||
const pageChange = (value: number) => { | ||
console.log(value); | ||
}; | ||
import { useTranslate } from '../../../utils'; | ||
import Basic from './basic.vue'; | ||
import Simple from './simple.vue'; | ||
import Ellipse from './ellipse.vue'; | ||
import Custom from './custom.vue'; | ||
const t = useTranslate({ | ||
'zh-CN': { | ||
basic: '基础用法', | ||
simple: '简单模式', | ||
ellipse: '显示省略号', | ||
custom: '自定义按钮' | ||
}, | ||
'en-US': { | ||
basic: 'Basic Usage', | ||
simple: 'Simple Mode', | ||
ellipse: 'Show ellipses', | ||
custom: 'Custom Button' | ||
} | ||
}); | ||
</script> |
10 changes: 10 additions & 0 deletions
10
packages/nutui-taro-demo/src/nav/pages/pagination/simple.vue
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,10 @@ | ||
<template> | ||
<nut-pagination v-model="page" :page-count="12" mode="simple" @change="change" /> | ||
</template> | ||
<script setup lang="ts"> | ||
import { ref } from 'vue'; | ||
const page = ref(1); | ||
const change = (value: number) => { | ||
console.log(value); | ||
}; | ||
</script> |
This file was deleted.
Oops, something went wrong.
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,10 @@ | ||
<template> | ||
<nut-pagination v-model="page" :total-items="25" :items-per-page="5" @change="change" /> | ||
</template> | ||
<script setup lang="ts"> | ||
import { ref } from 'vue'; | ||
const page = ref(1); | ||
const change = (value: number) => { | ||
console.log(value); | ||
}; | ||
</script> |
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,16 @@ | ||
<template> | ||
<nut-pagination v-model="page" :total-items="500" :show-page-size="5"> | ||
<template #prev-text> | ||
<Left width="10px" height="10px" /> | ||
</template> | ||
<template #next-text> | ||
<Right width="10px" height="10px" /> | ||
</template> | ||
<template #page="{ item }"> {{ item.number == 3 ? 'hot' : item.text }} </template> | ||
</nut-pagination> | ||
</template> | ||
<script setup lang="ts"> | ||
import { Left, Right } from '@nutui/icons-vue'; | ||
import { ref } from 'vue'; | ||
const page = ref(1); | ||
</script> |
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,7 @@ | ||
<template> | ||
<nut-pagination v-model="page" :total-items="125" :show-page-size="3" force-ellipses /> | ||
</template> | ||
<script setup lang="ts"> | ||
import { ref } from 'vue'; | ||
const page = ref(1); | ||
</script> |
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,38 @@ | ||
<template> | ||
<Demo> | ||
<h2>{{ t('basic') }}</h2> | ||
<Basic /> | ||
|
||
<h2>{{ t('simple') }}</h2> | ||
<Simple /> | ||
|
||
<h2>{{ t('ellipse') }}</h2> | ||
<Ellipse /> | ||
|
||
<h2>{{ t('custom') }}</h2> | ||
<Custom /> | ||
</Demo> | ||
</template> | ||
|
||
<script setup lang="ts"> | ||
import { useTranslate } from '@/sites/utils'; | ||
import Basic from './basic.vue'; | ||
import Simple from './simple.vue'; | ||
import Ellipse from './ellipse.vue'; | ||
import Custom from './custom.vue'; | ||
const t = useTranslate({ | ||
'zh-CN': { | ||
basic: '基础用法', | ||
simple: '简单模式', | ||
ellipse: '显示省略号', | ||
custom: '自定义按钮' | ||
}, | ||
'en-US': { | ||
basic: 'Basic Usage', | ||
simple: 'Simple Mode', | ||
ellipse: 'Show ellipses', | ||
custom: 'Custom Button' | ||
} | ||
}); | ||
</script> |
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,10 @@ | ||
<template> | ||
<nut-pagination v-model="page" :page-count="12" mode="simple" @change="change" /> | ||
</template> | ||
<script setup lang="ts"> | ||
import { ref } from 'vue'; | ||
const page = ref(1); | ||
const change = (value: number) => { | ||
console.log(value); | ||
}; | ||
</script> |
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
Oops, something went wrong.