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

yg-screen-scale

v1.0.9

Published

大屏缩放适配

Downloads

146

Readme

博客 | NPM地址 | git源码 | gitee源码

此工具就是利用transfrom:scale来缩放页面已达到自适应

安装

npm install yg-screen-scale

使用

通常是在项目app.vue中引入
import BigScreenScale from 'yg-screen-scale'
  ...
  data() {
    return {
      // 定义缩放对象
      BigScreenScale: null
    }
  },
  mounted() {
    // 初始化
    this.BigScreenScale = new BigScreenScale({container: 'app'}, (scale) => {
      console.log(scale);
    })
  },
  beforeDestroy() {
    // 移除监听
    this.BigScreenScale.clearListener()
  }
  ...

参数说明

初始化方法里面包括两个参数, 第一个是配置options,第二个是回调函数(会返回缩放的scale), options配置 | 名称 | 类型 | 必填 | 说明 |
| --- | --- | --- | --- | | container|string| 否 | 缩放的外层容器一般是app.vue中router-view的外层容器id值, 默认'app' | | time|number| 否 | 页面缩放后盒子修改的时间,单位ms 默认为500 防抖动时间 | | width|number| 否 | 设计图宽度单位px,默认1920 | | height|number| 否 | 设计图高度单位px,默认1080 | | type|number| 否 | 缩放的类型,1 等比缩放,2 宽度缩放,3 高度缩放,4 宽高各自缩放 | | align|string| 否 | 缩放后盒子的位置,默认'center', 居中显示, 其他字符串上面留白为空 |

注意事项

container 元素默认样式会被修改成overflow:hidden; position: absolute;

由于缩放页面导致使用百度地图的时候可能某些功能异常,需要对应的地图盒子进行相反的比例缩放比如外层的页面scale是0.5 地图就得缩放比例就得是2