Skip to content

Commit

Permalink
revert: 还原提交
Browse files Browse the repository at this point in the history
  • Loading branch information
ocean-gao committed Oct 17, 2024
1 parent cdab322 commit 974242f
Showing 1 changed file with 4 additions and 13 deletions.
17 changes: 4 additions & 13 deletions components/pagination/simpler.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import {
type ComponentObjectPropsOptions,
defineComponent,
ref,
toRefs,
watch,
} from 'vue';
Expand Down Expand Up @@ -38,9 +37,6 @@ export default defineComponent({

const [currentPage, updateCurrentPage] = useNormalModel(props, emit);

// 这里单独定义响应式变量,用 modelValue={currentPage.value} 的方式,会导致无效数据重复赋值可能内部不更新的情况
const innerCurrent = ref();

const handleCurrentChange = (current: number) => {
let temp = 0;
if (current < 1) {
Expand All @@ -53,8 +49,8 @@ export default defineComponent({
updateCurrentPage(temp);
};

// 处理输入页码 change 事件
const handleChange = (val: string) => {
// 处理输入页码的事件
const handleInputChange = (val: string) => {
// 如果用户输入是非数字的字符,则不做任何行为
const inputValue = Number(val);
if (Number.isNaN(inputValue)) {
Expand All @@ -68,11 +64,6 @@ export default defineComponent({
updateCurrentPage(total.value);
}
});
watch(currentPage, () => {
innerCurrent.value = currentPage.value;
}, {
immediate: true,
});

return () => (
<div class={`${prefixCls}-pager ${prefixCls}-simpler`}>
Expand All @@ -90,8 +81,8 @@ export default defineComponent({
{/* 当前页面页码 */}
<InputInner
class={`${prefixCls}-jumper-input`}
v-model={innerCurrent.value}
onChange={handleChange}
modelValue={currentPage.value}
onChange={handleInputChange}
></InputInner>
<div class={`${prefixCls}-simpler-total`}>
<i class={`${prefixCls}-simpler-total-split`}>/</i>
Expand Down

0 comments on commit 974242f

Please sign in to comment.