chore: add Numeric type
This commit is contained in:
@@ -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);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user