mirror of
https://github.com/unanmed/HumanBreak.git
synced 2025-06-28 05:07:59 +08:00
fix: Page 组件不能设置 page 参数
This commit is contained in:
parent
e0b3b2a68b
commit
ef0c6a1647
@ -8,7 +8,7 @@ import {
|
||||
VNode,
|
||||
watch
|
||||
} from 'vue';
|
||||
import { clamp } from 'lodash-es';
|
||||
import { clamp, isNil } from 'lodash-es';
|
||||
import { DefaultProps, ElementLocator, Font } from '@motajs/render';
|
||||
import { SetupComponentOptions } from '@motajs/system-ui';
|
||||
|
||||
@ -177,6 +177,18 @@ export const Page = defineComponent<
|
||||
updateRectAndText();
|
||||
}
|
||||
);
|
||||
watch(
|
||||
() => props.page,
|
||||
page => {
|
||||
if (!isNil(page)) {
|
||||
const target = clamp(page, 0, props.pages - 1);
|
||||
if (nowPage.value !== target) {
|
||||
nowPage.value = target;
|
||||
emit('pageChange', target);
|
||||
}
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
/**
|
||||
* 切换页码
|
||||
|
Loading…
Reference in New Issue
Block a user