✨(component): release 1.4.3
This commit is contained in:
parent
600bf608ba
commit
92694f5919
@ -48,4 +48,4 @@ const classes = computed(() => {
|
|||||||
<slot name="footer"></slot>
|
<slot name="footer"></slot>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
@ -48,14 +48,22 @@ const currentPage: Ref<number> = ref(props.modelValue);
|
|||||||
const currentPageShow: Ref<number> = ref(currentPage.value);
|
const currentPageShow: Ref<number> = ref(currentPage.value);
|
||||||
const inlimit = ref(props.limit);
|
const inlimit = ref(props.limit);
|
||||||
|
|
||||||
watch(() => props.limit, () => {
|
watch(
|
||||||
inlimit.value = props.limit;
|
() => props.limit,
|
||||||
})
|
() => {
|
||||||
|
inlimit.value = props.limit;
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
const totalPage = computed(() => {
|
const totalPage = computed(() => {
|
||||||
maxPage.value = Math.ceil(props.total / inlimit.value);
|
maxPage.value = Math.ceil(props.total / inlimit.value);
|
||||||
let r: number[] = [];
|
let r: number[] = [];
|
||||||
let start = maxPage.value <= props.pages ? 1 : currentPage.value > pages ? currentPage.value - pages : 1;
|
let start =
|
||||||
|
maxPage.value <= props.pages
|
||||||
|
? 1
|
||||||
|
: currentPage.value > pages
|
||||||
|
? currentPage.value - pages
|
||||||
|
: 1;
|
||||||
for (let i = start; ; i++) {
|
for (let i = start; ; i++) {
|
||||||
if (r.length >= props.pages || i > maxPage.value) {
|
if (r.length >= props.pages || i > maxPage.value) {
|
||||||
break;
|
break;
|
||||||
@ -96,15 +104,15 @@ const jumpPage = () => {
|
|||||||
const changelimit = () => {
|
const changelimit = () => {
|
||||||
currentPage.value = 1;
|
currentPage.value = 1;
|
||||||
emit("change", { current: currentPage.value, limit: inlimit.value });
|
emit("change", { current: currentPage.value, limit: inlimit.value });
|
||||||
}
|
};
|
||||||
|
|
||||||
const refresh = () => {
|
const refresh = () => {
|
||||||
emit("change", { current: currentPage.value, limit: inlimit.value });
|
emit("change", { current: currentPage.value, limit: inlimit.value });
|
||||||
}
|
};
|
||||||
|
|
||||||
watch(inlimit, () => {
|
watch(inlimit, () => {
|
||||||
emit("update:limit", inlimit.value);
|
emit("update:limit", inlimit.value);
|
||||||
})
|
});
|
||||||
|
|
||||||
watch(currentPage, () => {
|
watch(currentPage, () => {
|
||||||
const min = totalPage.value[0];
|
const min = totalPage.value[0];
|
||||||
@ -178,7 +186,12 @@ watch(
|
|||||||
</option>
|
</option>
|
||||||
</select>
|
</select>
|
||||||
</span>
|
</span>
|
||||||
<a v-if="showRefresh" href="javascript:;" @click="refresh" class="layui-laypage-refresh">
|
<a
|
||||||
|
v-if="showRefresh"
|
||||||
|
href="javascript:;"
|
||||||
|
@click="refresh"
|
||||||
|
class="layui-laypage-refresh"
|
||||||
|
>
|
||||||
<i class="layui-icon layui-icon-refresh"></i>
|
<i class="layui-icon layui-icon-refresh"></i>
|
||||||
</a>
|
</a>
|
||||||
<span v-if="props.showSkip" class="layui-laypage-skip">
|
<span v-if="props.showSkip" class="layui-laypage-skip">
|
||||||
@ -199,4 +212,4 @@ watch(
|
|||||||
</button>
|
</button>
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user