Files
SingBox-Gopanel/frontend/admin/node_modules/element-plus/es/hooks/use-calc-input-width/index.mjs
CN-JS-HuiBai db7f1ba82f
Some checks failed
build / build (api, amd64, linux) (push) Failing after -51s
build / build (api, arm64, linux) (push) Failing after -52s
build / build (api.exe, amd64, windows) (push) Failing after -51s
使用VUE重构项目
2026-04-20 00:19:11 +08:00

23 lines
764 B
JavaScript

import { MINIMUM_INPUT_WIDTH } from "../../constants/form.mjs";
import { useResizeObserver } from "@vueuse/core";
import { computed, ref, shallowRef } from "vue";
//#region ../../packages/hooks/use-calc-input-width/index.ts
function useCalcInputWidth() {
const calculatorRef = shallowRef();
const calculatorWidth = ref(0);
const inputStyle = computed(() => ({ minWidth: `${Math.max(calculatorWidth.value, MINIMUM_INPUT_WIDTH)}px` }));
const resetCalculatorWidth = () => {
calculatorWidth.value = calculatorRef.value?.getBoundingClientRect().width ?? 0;
};
useResizeObserver(calculatorRef, resetCalculatorWidth);
return {
calculatorRef,
calculatorWidth,
inputStyle
};
}
//#endregion
export { useCalcInputWidth };
//# sourceMappingURL=index.mjs.map