mirror of
https://gitee.com/vant-contrib/vant.git
synced 2026-07-06 14:51:05 +08:00
Compare commits
3 Commits
03c2f241b8
...
651305e8ce
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
651305e8ce | ||
|
|
12a0f9a24c | ||
|
|
334699d264 |
@ -41,7 +41,7 @@ export function useTouch() {
|
||||
const move = ((event: TouchEvent) => {
|
||||
const touch = event.touches[0];
|
||||
// safari back will set clientX to negative number
|
||||
deltaX.value = touch.clientX < 0 ? 0 : touch.clientX - startX.value;
|
||||
deltaX.value = (touch.clientX < 0 ? 0 : touch.clientX) - startX.value;
|
||||
deltaY.value = touch.clientY - startY.value;
|
||||
offsetX.value = Math.abs(deltaX.value);
|
||||
offsetY.value = Math.abs(deltaY.value);
|
||||
|
||||
@ -65,6 +65,16 @@ const numberKeyboardProps = {
|
||||
|
||||
export type NumberKeyboardProps = ExtractPropTypes<typeof numberKeyboardProps>;
|
||||
|
||||
function shuffle(array: unknown[]) {
|
||||
for (let i = array.length - 1; i > 0; i--) {
|
||||
const j = Math.floor(Math.random() * (i + 1));
|
||||
const temp = array[i];
|
||||
array[i] = array[j];
|
||||
array[j] = temp;
|
||||
}
|
||||
return array;
|
||||
}
|
||||
|
||||
export default defineComponent({
|
||||
name,
|
||||
|
||||
@ -89,7 +99,7 @@ export default defineComponent({
|
||||
.map((_, i) => ({ text: i + 1 }));
|
||||
|
||||
if (props.randomKeyOrder) {
|
||||
keys.sort(() => (Math.random() > 0.5 ? 1 : -1));
|
||||
shuffle(keys);
|
||||
}
|
||||
|
||||
return keys;
|
||||
|
||||
@ -365,6 +365,7 @@ export default defineComponent({
|
||||
const renderNav = () =>
|
||||
children.map((item, index) => (
|
||||
<TabsTitle
|
||||
key={item.id}
|
||||
v-slots={{ title: item.$slots.title }}
|
||||
id={`${id}-${index}`}
|
||||
ref={setTitleRefs(index)}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user