npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@better-libs/screen-adapter

v0.0.8-alpha.0

Published

```bash npm install @better-libs/screen-adapter -S yarn add @better-libs/screen-adapter -S ```

Downloads

8

Readme

屏幕强制横竖屏组件

使用简单配置做强制横竖屏
Install 安装
npm install @better-libs/screen-adapter -S
yarn add @better-libs/screen-adapter -S
import ScreenAdapter from "@better-libs/screen-adapter";

new ScreenAdapter({
  wrapper: "#app",
  direction: "horizontal",
  mode: "fill",
});
CDN
<script src="https://cdn.jsdelivr.net/npm/@better-libs/screen-adapter@latest/dist/screen-adapter.js">
<!-- 或者 -->
<script src="https://cdn.jsdelivr.net/npm/@better-libs/screen-adapter@latest/dist/screen-adapter.min.js">
new ScreenAdapter({
  wrapper: "#app",
  direction: "horizontal",
  mode: "fill",
});

配置

ScreenAdapter 可以在初始化时传入一个 options,比如

import ScreenAdapter from "@better-libs/screen-adapter";

new ScreenAdapter({
  wrapper: "#app",
  direction: "horizontal",
  mode: "fill",
});

tips: 支持移动端使用,并且在使用时需要加上 meta 标签

<meta
  name="viewport"
  content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no"
/>

下面列举 ScreenAdapter 支持的参数

wrapper

  • 是否必传: true
  • 类型: string
  • 说明: wrapper 为指定强制横竖屏的容器

direction

  • 是否必传: false
  • 类型: string
  • 默认: vertical
  • 可选值: vertical | horizontal
  • 说明: 当指定 direction 为 vertical 时,则 wrapper 容器为强制横屏; 当指定 direction 为 horizontal 时,则 wrapper 容器为强制竖屏。

mode

  • 是否必传: false
  • 类型: string
  • 默认: fill
  • 可选值: fill | width | height
  • 说明: 当不设置 width 和 height 时,该属性无效。fill 时为容器宽度和容器高度撑满屏幕宽高;width 为容器宽度撑满屏幕宽度,容器高度这自适应;height 为容器高度撑满屏幕高度,宽度自适应。

width

  • 是否必传: false
  • 类型: number
  • 默认: 当 direction 为 vertical 时为屏幕长边,相反则为屏幕短边
  • 说明: 设置 wrapper 容器宽度

height

  • 是否必传: false
  • 类型: number
  • 默认: 当 direction 为 vertical 时为屏幕短边,相反则为屏幕长边
  • 说明: 设置 wrapper 容器高度

github 地址:https://github.com/pikacyxooo/better-libs/tree/main/packages/screen-adapter