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

@yangtaowei/b-s-adaption

v1.4.0

Published

Automatic adjustment of large screen display

Downloads

7

Readme

简介

b-s-adaption 是一个开源的大屏显示插件。支持原生Dom,vue2(mixins),vue3(hooks)

特性

无需繁琐设置大屏内容 无需考虑比率 直接引入插件即可

无需繁琐设置大屏内容

按需使用,引入后插件会自动计算比率 使用css缩放方式完成,类似于echarts等的可视化数据再也不需要看官方api适应各种屏幕了

无需考虑比率

仅仅需要传入设计图纸宽高,插件会自动计算

直接引入插件即可

使用npm 安装后 只需引入后传入DOM即可 没有任何繁琐操作

vue2 使用 {useDrawToVue2} from '@yangtaowei/b-s-adaption'

vue3 使用 {useDrawToVue3} from '@yangtaowei/b-s-adaption'

支持esm 和 commonjs 分别在/dist/下

安装使用

  • 安装依赖
npm i @yangtaowei/b-s-adaption --save
  • 页面内引用

vue2,挂载mixins,传入vueRefName即可

 <template>
    <div ref='drawDom'>...</div>
 </template>
 <script>
 import {useDrawToVue2} from '@yangtaowei/b-s-adaption/dist/index-esm.js
 export default{
    mixins:[useDrawToVue2(drawDom(String),options)]
    data(){
       return{...}
    }
 }
 </script>

vue3,使用hooks,传入组件Ref即可

<template>
<div ref='drawDom'></div>
</template>
<script setup>
    import { onMounted, onBeforeUnmount } from 'vue'
    import { useDrawToVue3 } from '@yangtaowei/b-s-adaption/dist/index.esm.js'
    import { ref } from 'vue'
    let drawDom = ref(null)
    const { calcRate, resize } = useDrawToVue3(drawDom, { baseWidth: 1920, baseHeight: 1080 })
    onMounted(() => {
        calcRate()
        window.addEventListener('resize', resize, false)
    })
    onBeforeUnmount(() => window.removeEventListener('resize', resize, false))
</script>

html普通Dom,传入元素id即可

<html>
<body>
<div id='DomIdName'>
    ...
</div>
<script type='module'>
    import {useDrawToDom} from '@yangtaowei/b-s-adaption/dist/index-esm.js'
    useDrawToDom(DomIdName(String))
</script>  
</body>
</html>

浏览器支持

本地开发推荐使用Chrome 80+ 浏览器

支持现代浏览器, 支持 IE