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 🙏

© 2025 – Pkg Stats / Ryan Hefner

vue-responsive-waterfall

v1.0.6

Published

一個簡易的 Vue 3 瀑布流布局組件,支援響應式設計和Slot自定義內容

Readme

這是一個簡易的 Vue 3 瀑布流布局組件,支援響應式設計和Slot自定義內容。 也是我嘗試做的第一個開源套件,許多部分都是邊查網頁、邊問AI完成的,

但凡事都有第一次嘛,下次再來試試看能不能做一個真正解決問題的套件。

安裝

npm i vue-responsive-waterfall
// main.js
import { createApp } from 'vue'
import App from './App.vue'
// 引入
import VueWaterfall from 'vue-responsive-waterfall'
import 'vue-responsive-waterfall/dist/vue-responsive-waterfall.css'

const app = createApp(App)
app.use(VueWaterfall)
app.mount('#app')

基本使用

<template>
  <WaterfallContainer :items="images" />
</template>

<script setup>
import { WaterfallContainer } from 'vue-waterfall-layout'

const images = [
  { id: 1, src: 'https://example.com/image1.jpg' },
  { id: 2, src: 'https://example.com/image2.jpg' },
  // ...
]
</script>

組件屬性

| 屬性名 | 類型 | 預設值 | 說明 | |--------------------|--------------------------------|--------|--------------------------| | items | WaterfallItem[] | [] | 瀑布流項目數據 | | columns | number | 3 | 列數 | | gap | number | 10 | 項目間距(px) | | minColumnWidth | number | 200 | 最小列寬(px) | | hoverEffect | boolean | true | 是否啟用 hover 效果 | | fadeInAndOut | boolean | false| 是否啟用淡入淡出動畫 | | clickFunction | function | - | 點擊事件回調 | | hoverFunction | function | - | hover 事件回調 | | hoverLeaveFunction | function | - | hover 離開事件回調 |

數據格式

interface WaterfallItem {
  id: number | string
  src: string
  alt?: string
  width?: number
  height?: number
  [key: string]: unknown  // 支援自定義屬性
}

自定義內容

使用 slot 自定義每個項目的內容:

<template>
  <WaterfallContainer :items="items">
    <template #default="{ item, index }">
      <div class="custom-card">
        <img :src="item.src" :alt="item.alt" />
        <div class="content">
          <h3>{{ item.title }}</h3>
          <p>{{ item.description }}</p>
        </div>
      </div>
    </template>
  </WaterfallContainer>
</template>

事件處理

<template>
  <WaterfallContainer 
    :items="items"
    :click-function="handleClick"
    :hover-function="handleHover"
  />
</template>

<script setup>
const handleClick = (item) => {
  console.log('點擊項目:', item)
}

const handleHover = (item) => {
  console.log('Hover 項目:', item)
}
</script>

開發

# 安裝依賴
npm install

# 開發模式
npm run dev

# 建置
npm run build

# 代碼檢查
npm run lint

功能

  • 響應式設計,自動適應螢幕寬度
  • 支援圖片懶載入
  • 內建骨架屏載入效果
  • TypeScript 支援
  • 支援自定義內容和事件

許可

MIT