|
@@ -1,4 +1,4 @@
|
|
-<script setup lang="ts">
|
|
|
|
|
|
+<script setup>
|
|
import { onMounted, ref, computed, watch } from 'vue'
|
|
import { onMounted, ref, computed, watch } from 'vue'
|
|
const emit = defineEmits(['maxPage', 'clickHandle', 'input'])
|
|
const emit = defineEmits(['maxPage', 'clickHandle', 'input'])
|
|
const props = defineProps({
|
|
const props = defineProps({
|
|
@@ -31,7 +31,7 @@ const props = defineProps({
|
|
default: '#2d2d2d'
|
|
default: '#2d2d2d'
|
|
}
|
|
}
|
|
})
|
|
})
|
|
-const index = ref<number>(props.value)
|
|
|
|
|
|
+const index = ref(props.value)
|
|
const maxPage = computed(() => {
|
|
const maxPage = computed(() => {
|
|
let val = Math.ceil(props.total / props.equable)
|
|
let val = Math.ceil(props.total / props.equable)
|
|
emit('maxPage', val)
|
|
emit('maxPage', val)
|
|
@@ -40,16 +40,16 @@ const maxPage = computed(() => {
|
|
const pages = computed(() => {
|
|
const pages = computed(() => {
|
|
return getPageNumArr(props.length, index.value, maxPage.value)
|
|
return getPageNumArr(props.length, index.value, maxPage.value)
|
|
})
|
|
})
|
|
-const useUser = useUserStore()
|
|
|
|
-useUser.getInfo()
|
|
|
|
|
|
+// const useUser = useUserStore()
|
|
|
|
+// useUser.getInfo()
|
|
// 监听过滤数据变化更新总数
|
|
// 监听过滤数据变化更新总数
|
|
-watch(index.value, (newVal: number) => {
|
|
|
|
|
|
+watch(index.value, (newVal) => {
|
|
emit('input', newVal)
|
|
emit('input', newVal)
|
|
})
|
|
})
|
|
-watch(props.current, (newVal: number) => {
|
|
|
|
|
|
+watch(props.current, (newVal) => {
|
|
index.value = newVal
|
|
index.value = newVal
|
|
})
|
|
})
|
|
-watch(props.total, (newVal: number) => {
|
|
|
|
|
|
+watch(props.total, (newVal) => {
|
|
if (index.value > maxPage.value) {
|
|
if (index.value > maxPage.value) {
|
|
index.value = maxPage.value
|
|
index.value = maxPage.value
|
|
clickHandle(maxPage.value)
|
|
clickHandle(maxPage.value)
|
|
@@ -59,7 +59,7 @@ onMounted(() => {
|
|
emit('maxPage', maxPage)
|
|
emit('maxPage', maxPage)
|
|
})
|
|
})
|
|
function clickHandle(indexs) {
|
|
function clickHandle(indexs) {
|
|
- if (indexs > 0 && indexs <= this.maxPage) {
|
|
|
|
|
|
+ if (indexs > 0 && indexs <= maxPage.value) {
|
|
index.value = indexs
|
|
index.value = indexs
|
|
}
|
|
}
|
|
emit('clickHandle', index.value)
|
|
emit('clickHandle', index.value)
|