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 🙏

© 2026 – Pkg Stats / Ryan Hefner

ln-cos-web

v0.0.8

Published

### 普通图片

Readme

ln-cos-web

普通图片

    <img src="src/assets/demo2.png" alt="普通图片" />

传宽高用法:默认contain

  <LnImage
    class="image-example-border h-[200px] w-[200px]"
    :src="src"
  ></LnImage>

object-fit:cover

  <LnImage
    class="image-example-border h-[200px] w-[200px]"
    :src="src"
    fit="cover"
  ></LnImage>

保证图片完整展示:传正确比例的宽度+高度

  <LnImage
    class="image-example-border h-[160px] w-[200px]"
    :src="src"
    fit="cover"
  ></LnImage>

保证图片完整展示:传宽度+scale

  <div class="w-[200px]">
    <LnImage
    class="image-example-border"
    :scale="1250 / 1000"
    :src="src"
    fit="cover"
    ></LnImage>
  </div>

不传width和height:默认根据外部容器撑开

  <div class="h-[200px] w-[200px]">
    <LnImage class="image-example-border" :src="src"></LnImage>
  </div>

scale用法:根据外部容器宽度保持图片比例,主要用于flex/grid布局

  <ul class="grid grid-cols-4">
    <li v-for="item of 4" :key="item">
      <LnImage
        :scale="1250 / 1000"
        :src="src"
      ></LnImage>
    </li>
  </ul>

增加背景颜色:isUseImageAve,图片加载完成之前,展示背景颜色,颜色为图片的主色调

      <LnImage
        :width="200"
        :height="200"
        :src="slowSrc"
        isUseImageAve
      ></LnImage>

修改转换格式:format

      <LnImage
        :width="200"
        :height="200"
        :src="slowSrc"
        format="jpg"
      ></LnImage>

自定义图片处理:process,可以自定义成任意想要的图片地址,参数是已经算好的各种Cos处理参数

      const processFn = (processParams) => {
        console.log('processParams', processParams)
        const slowSrc = 'https://image-platform.leniugame.com/act/mxty_ng/%E5%AE%8C%E6%95%B4%E5%BA%95.png'
        return slowSrc
      }
      <LnImage
        :width="200"
        :height="200"
        :src="src"
        :process="processFn"
      ></LnImage>

懒加载:默认支持

  <LnImage
    class="image-example-border h-[200px] w-[200px]"
    :src="src"
    isUseImageAve
    fit="cover"
  ></LnImage>

水印

  <div class="w-full">
    <LnImage
    class="image-example-border"
    :scale="1250 / 1000"
    :src="src"
    :watermark="{
      text: '测试一下',
    }"
    fit="cover"
    ></LnImage>
  </div>

图片按钮

  <div class="w-[200px]">
    <LnImage :scale="570 / 148" :src="downloadButtonSrc" isButton></LnImage>
  </div>

图片按钮:disabled(默认会置灰)

  <div class="w-[200px]">
    <LnImage
    :scale="570 / 148"
    :src="downloadButtonSrc"
    isButton
    disabled
    ></LnImage>
  </div>

背景图片:

  <div>
    <LnImage class="image-example-border" :scale="1250 / 1000" :src="src">
    <div class="flex justify-center">
      <div class="absolute bottom-0 w-[200px]">
      <LnImage
        :scale="570 / 148"
        :src="downloadButtonSrc"
        isButton
      ></LnImage>
      </div>
    </div>
    </LnImage>
  </div>