chore: add Numeric type

This commit is contained in:
chenjiahan
2022-03-27 17:40:00 +08:00
parent dbad7571ac
commit 8dc8c54bca
126 changed files with 238 additions and 194 deletions
+4 -3
View File
@@ -25,6 +25,7 @@ import {
createNamespace,
getRootScrollTop,
setRootScrollTop,
type Numeric,
} from '../utils';
// Composables
@@ -58,7 +59,7 @@ const indexBarProps = {
highlightColor: String,
stickyOffsetTop: makeNumberProp(0),
indexList: {
type: Array as PropType<Array<string | number>>,
type: Array as PropType<Numeric[]>,
default: genAlphabet,
},
};
@@ -76,7 +77,7 @@ export default defineComponent({
setup(props, { emit, slots }) {
const root = ref<HTMLElement>();
const activeAnchor = ref<string | number>('');
const activeAnchor = ref<Numeric>('');
const touch = useTouch();
const scrollParent = useScrollParent(root);
@@ -207,7 +208,7 @@ export default defineComponent({
);
});
const scrollTo = (index: string | number) => {
const scrollTo = (index: Numeric) => {
selectActiveIndex = String(index);
const match = getMatchAnchor(selectActiveIndex);