
Security News
Attackers Are Hunting High-Impact Node.js Maintainers in a Coordinated Social Engineering Campaign
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.
大屏适配主要是解决屏幕尺寸比和设计稿尺寸比不一致的问题,采用的方法是:scale
虽然这种方案并不完美,但也是目前比较好的解决方案
比如在 pc 上就不是特别完美,特别是老型号 windows 机器,分辨率各种各样
但在大屏上看就会很完美,因为大屏的分辨率一般都是 16:9 的,而设计稿一般都是 1920*1080
然后在使用 scale 缩放时,主要有 3 个问题
overflow: scroll 的地方,文本可能会出现模糊开发这个组件就是为了解决这 3 个问题
npm i adaptorjs
# 或
yarn add adaptorjs
# 或
pnpm i adaptorjs
import Adaptor from "adaptorjs";
const adaptor = new Adaptor({
designHeight: 1080,
designWidth: 1920,
querySelector: "#app",
extraSelectors: [".xxx"],
});
要在 dom 加载完成后再初始化
react 中使用useEffect(() => {
const adaptor = new Adaptor({
designHeight: 1080,
designWidth: 1920,
querySelector: "#app",
extraSelectors: [".xxx"],
});
return () => {
adaptor.destroy();
};
}, []);
vue 中使用let adaptor;
onMounted(() => {
adaptor = new Adaptor({
designHeight: 1080,
designWidth: 1920,
querySelector: "#app",
extraSelectors: [".xxx"],
});
});
onUnmounted(() => {
adaptor.destroy();
});
querySelector: string // 大屏根选择器,必选
extraQuerySelectors?: string[]; // 需要额外缩放的 dom 选择器,可选
designWidth?: number; // 设计稿宽度,可选,默认 1920
designHeight?: number; // 设计稿高度,可选,默认 1080
type?: ScaleType; // 缩放类型,可选,默认 scale
git clone https://github.com/astak16/adaptorjs.git
cd adaptorjs
pnpm i
pnpm dev
FAQs
adaptorjs 是一款自适应的大屏工具,适用于 react/vue 等框架
We found that adaptorjs demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.

Security News
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.

Security News
Node.js has paused its bug bounty program after funding ended, removing payouts for vulnerability reports but keeping its security process unchanged.