Skip to content

Instantly share code, notes, and snippets.

View lisonge's full-sized avatar
🐳
❀💧

二刺螈 lisonge

🐳
❀💧
View GitHub Profile
import { ElDialog } from 'element-plus'
/**
* 解决 ElDialog 不显示时仍然渲染内容的问题
*/
const PerfDialog = defineComponent(
(props, ctx) => {
const render = shallowRef(props.modelValue)
const onClosed = async () => {
await nextTick()
export const createInheritedComposable = <F extends (...args: any[]) => any>(fn: F): F => {
const key = Symbol('inherited-composable-' + Date.now())
return ((...args: any[]) => {
let r: any = inject(key, key)
if (r === key) {
r = fn(...args)
provide(key, r)
}
return r
}) as F
<script lang="ts">
const modules: Record<string, { default: string }> = import.meta.glob(
'@/assets/svg/*.svg',
{
eager: true,
query: 'raw',
},
);
const svgElMap = Object.fromEntries(
import type { SlotsType, VNode } from 'vue'
import { Comment, Fragment } from 'vue'
const isEmpty = (nodes: VNode[] | undefined): boolean => {
if (!nodes?.length) return true
return nodes.every((v) => {
return (
v.type === Comment ||
(v.type === Fragment && isEmpty(v.children as VNode[])) ||
// @ts-ignore
java.lang.Throwable
at example.ExampleKt.main(Example.kt:11)
at example.ExampleKt.main(Example.kt)
2025-09-17 11:16:02.703 [info] [main] Log level: Info
2025-09-17 11:16:02.703 [info] [main] Validating found git in: "C:\Program Files\Git\cmd\git.exe"
2025-09-17 11:16:02.703 [info] [main] Validating found git in: "C:\Program Files (x86)\Git\cmd\git.exe"
2025-09-17 11:16:02.703 [info] [main] Validating found git in: "C:\Program Files\Git\cmd\git.exe"
2025-09-17 11:16:02.703 [info] [main] Validating found git in: "C:\Users\lisonge\AppData\Local\Programs\Git\cmd\git.exe"
2025-09-17 11:16:05.675 [info] [main] Log level: Info
2025-09-17 11:16:05.675 [info] [main] Validating found git in: "C:\Program Files\Git\cmd\git.exe"
2025-09-17 11:16:05.675 [info] [main] Validating found git in: "C:\Program Files (x86)\Git\cmd\git.exe"
2025-09-17 11:16:05.676 [info] [main] Validating found git in: "C:\Program Files\Git\cmd\git.exe"
2025-09-17 11:16:05.676 [info] [main] Validating found git in: "C:\Users\lisonge\AppData\Local\Programs\Git\cmd\git.exe"
export {};
import { shallowRef, onScopeDispose } from 'vue';
async function* timer(delay: number) {
let breaked = false;
const stop = () => (breaked = true);
for (let i = 1, st = performance.now(), et = st, errorMs = 0; ; i++) {
await new Promise((r) => setTimeout(r, delay - errorMs));
yield stop;
if (breaked) return;
et = performance.now();
import { isEqual } from 'lodash-es'
import { customRef, computed, type ShallowRef } from 'vue'
export const useEqualRef = <T>(initValue: T): ShallowRef<T> => {
return customRef((track, trigger) => {
let value = initValue
return {
get() {
track()
return value
fun Activity.fixTransparentNavigationBar() {
// 修复在浅色主题下导航栏背景不透明的问题
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) {
window.isNavigationBarContrastEnforced = false
} else {
@Suppress("DEPRECATION")
window.navigationBarColor = Color.TRANSPARENT
}
}
@lisonge
lisonge / list.kt
Last active March 13, 2025 12:06
import androidx.compose.foundation.background
import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.layout.Spacer
import androidx.compose.foundation.layout.aspectRatio
import androidx.compose.foundation.layout.fillMaxHeight