mirror of
https://github.com/MetaCubeX/metacubexd.git
synced 2024-11-14 06:25:35 +08:00
fix: btn animate
This commit is contained in:
parent
5d43ea0b5f
commit
a29e638c1e
@ -7,6 +7,7 @@ import ProxyCardGroups from '~/components/ProxyCardGroups'
|
|||||||
import ProxyNodePreview from '~/components/ProxyNodePreview'
|
import ProxyNodePreview from '~/components/ProxyNodePreview'
|
||||||
import { useProxies } from '~/signals/proxies'
|
import { useProxies } from '~/signals/proxies'
|
||||||
import type { Proxy } from '~/types'
|
import type { Proxy } from '~/types'
|
||||||
|
import { getBtnElFromClickEvent } from '~/utils/proxies'
|
||||||
|
|
||||||
export default () => {
|
export default () => {
|
||||||
const [t] = useI18n()
|
const [t] = useI18n()
|
||||||
@ -22,7 +23,7 @@ export default () => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const onSpeedTestClick = async (e: MouseEvent, name: string) => {
|
const onSpeedTestClick = async (e: MouseEvent, name: string) => {
|
||||||
const el = e.target as HTMLElement
|
const el = getBtnElFromClickEvent(e)
|
||||||
|
|
||||||
el.classList.add('animate-pulse')
|
el.classList.add('animate-pulse')
|
||||||
e.stopPropagation()
|
e.stopPropagation()
|
||||||
|
@ -7,7 +7,7 @@ import ProxyCardGroups from '~/components/ProxyCardGroups'
|
|||||||
import ProxyNodePreview from '~/components/ProxyNodePreview'
|
import ProxyNodePreview from '~/components/ProxyNodePreview'
|
||||||
import SubscriptionInfo from '~/components/SubscriptionInfo'
|
import SubscriptionInfo from '~/components/SubscriptionInfo'
|
||||||
import { useProxies } from '~/signals/proxies'
|
import { useProxies } from '~/signals/proxies'
|
||||||
import { formatTimeFromNow } from '~/utils/proxies'
|
import { formatTimeFromNow, getBtnElFromClickEvent } from '~/utils/proxies'
|
||||||
|
|
||||||
export default () => {
|
export default () => {
|
||||||
const [t] = useI18n()
|
const [t] = useI18n()
|
||||||
@ -23,7 +23,7 @@ export default () => {
|
|||||||
)
|
)
|
||||||
|
|
||||||
const onHealthCheckClick = async (e: MouseEvent, name: string) => {
|
const onHealthCheckClick = async (e: MouseEvent, name: string) => {
|
||||||
const el = e.target as HTMLElement
|
const el = getBtnElFromClickEvent(e)
|
||||||
|
|
||||||
el.classList.add('animate-pulse')
|
el.classList.add('animate-pulse')
|
||||||
e.stopPropagation()
|
e.stopPropagation()
|
||||||
@ -32,7 +32,7 @@ export default () => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const onUpdateProviderClick = async (e: MouseEvent, name: string) => {
|
const onUpdateProviderClick = async (e: MouseEvent, name: string) => {
|
||||||
const el = e.target as HTMLElement
|
const el = getBtnElFromClickEvent(e)
|
||||||
|
|
||||||
el.classList.add('animate-spin')
|
el.classList.add('animate-spin')
|
||||||
e.stopPropagation()
|
e.stopPropagation()
|
||||||
@ -41,7 +41,7 @@ export default () => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const onUpdateAllProviderClick = async (e: MouseEvent) => {
|
const onUpdateAllProviderClick = async (e: MouseEvent) => {
|
||||||
const el = e.target as HTMLElement
|
const el = getBtnElFromClickEvent(e)
|
||||||
|
|
||||||
el.classList.add('animate-spin')
|
el.classList.add('animate-spin')
|
||||||
e.stopPropagation()
|
e.stopPropagation()
|
||||||
|
@ -3,7 +3,7 @@ import { IconReload } from '@tabler/icons-solidjs'
|
|||||||
import InfiniteScroll from 'solid-infinite-scroll'
|
import InfiniteScroll from 'solid-infinite-scroll'
|
||||||
import { For, Show, createMemo, createSignal, onMount } from 'solid-js'
|
import { For, Show, createMemo, createSignal, onMount } from 'solid-js'
|
||||||
import { useRules } from '~/signals/rules'
|
import { useRules } from '~/signals/rules'
|
||||||
import { formatTimeFromNow } from '~/utils/proxies'
|
import { formatTimeFromNow, getBtnElFromClickEvent } from '~/utils/proxies'
|
||||||
|
|
||||||
export default () => {
|
export default () => {
|
||||||
const [t] = useI18n()
|
const [t] = useI18n()
|
||||||
@ -22,7 +22,7 @@ export default () => {
|
|||||||
})
|
})
|
||||||
|
|
||||||
const onUpdateProviderClick = async (e: MouseEvent, name: string) => {
|
const onUpdateProviderClick = async (e: MouseEvent, name: string) => {
|
||||||
const el = e.target as HTMLElement
|
const el = getBtnElFromClickEvent(e)
|
||||||
|
|
||||||
el.classList.add('animate-spin')
|
el.classList.add('animate-spin')
|
||||||
e.stopPropagation()
|
e.stopPropagation()
|
||||||
@ -31,7 +31,7 @@ export default () => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const onUpdateAllProviderClick = async (e: MouseEvent) => {
|
const onUpdateAllProviderClick = async (e: MouseEvent) => {
|
||||||
const el = e.target as HTMLElement
|
const el = getBtnElFromClickEvent(e)
|
||||||
|
|
||||||
el.classList.add('animate-spin')
|
el.classList.add('animate-spin')
|
||||||
e.stopPropagation()
|
e.stopPropagation()
|
||||||
|
@ -6,3 +6,13 @@ dayjs.extend(relativeTime)
|
|||||||
export function formatTimeFromNow(time: number | string) {
|
export function formatTimeFromNow(time: number | string) {
|
||||||
return dayjs(time).fromNow()
|
return dayjs(time).fromNow()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function getBtnElFromClickEvent(event: MouseEvent) {
|
||||||
|
let el = event.target as HTMLElement
|
||||||
|
|
||||||
|
while (el && !el.classList.contains('btn')) {
|
||||||
|
el = el.parentElement!
|
||||||
|
}
|
||||||
|
|
||||||
|
return el
|
||||||
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user