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

vue-iphonex

v1.0.1

Published

A Vue directive to determine if it is an iPhoneX

Downloads

40

Readme

安装

npm安装:


$ npm install vue-iphonex --save

使用

//main.js

import VueIphonex from 'vue-iphonex'

Vue.use(VueIphonex)
<div id="root" v-iphonex>
        <div class="playground">
            <div :class="['left',fringeDirection == 'left' ? 'fringe_left' : '']"></div>
            <div :class="['right',fringeDirection == 'right' ? 'fringe_right' : '']"></div>
            <div :class="['bottom',isIphonex && !fringeDirection ? 'x_bottom' : '']"></div>
        </div>
    </div>
    <script>
        Vue.use(VueIphonex)
        new Vue({
            el: '#root',
            data(){
                return {
                    isIphonex: false,
                    fringeDirection: ''
                }
            },
            mounted: function() {
                let _this = this
                this.$iphonex.$on('init', (v) => {
                    _this.isIphonex = v
                })
                this.$iphonex.$on('rotate',(v)=>{
                    _this.fringeDirection = v
                })
            }
        })
    </script>

注意加上v-iphonex指令 使用this.$iphonex.$on监听initrotate事件 init事件会返回Boolean类型,true表示是iPhoneX rotate事件会返回String类型,分别为left:刘海在左,right:刘海在右,''空字符串为垂直方向

License

The MIT License

效果图

是iPhoneX时,为底部添加34px

是iPhoneX且刘海在左时,为左边添加44px

是iPhoneX且刘海在右时,为右边添加44px