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

mp-waterfall

v1.0.21

Published

miniprogram waterfall, waterfall, Wechat mini waterfall

Downloads

3

Readme

npm install mp-waterfall

Required*

  • The project root directory must have templates/waterfall-item.wxml

templates/waterfall-item.wxml

<template name="waterfall-item">
    <view class="item" catchtap="onItemClick" data-item="{{item}}">
        <image src="{{item.image}}" mode="widthFix"></image>
        <view>{{channelSource}}</view>
        <text>{{item.desc}}</text>
    </view>
</template>

Focus*

name is must waterfall-item

The template receives two fields: item, channelSource

Demo

  • json
{
  "usingComponents": {
    "mp-waterfall": "mp-waterfall/mp-waterfall/mp-waterfall"
  }
}
  • wxml
<view class="box">
    <mp-waterfall bind:getData="getData" id="waterfall" catchonItemClick="onItemClick" data="{{list}}" columns="{{2}}" delay="{{120}}" rowGap="40rpx" columnGap="40rpx" channelSource="recommend" events="onItemClick, handleTap">
    </mp-waterfall>
</view>

Important tip

Drive the way the page is updated

1: You can use data properties to drive component updates (local changes can work with component methods to drive component updates)

2: You can update components by component methods: append, prepend, clear, remove, refresh

Note: The component is bound to getData to get the latest data state within the component

append(data)、 prepend(data)、 clear()、 remove(condition), refresh(condition, newVal), update(condition, newVal)

refresh is an alias for update and has the same function of partially refreshing (updating) the UI


解释同上:

驱动页面更新的途径

1:你可以通过data属性驱动组件更新 (局部变化可以配合组件方法驱动组件更新)

2:你可以通过组件方法: append、prepend、clear、remove、refresh 更新组件

注意:组件上绑定getData来获取组件内部最新数据状态

append(data)、 prepend(data)、 clear()、 remove(condition), refresh(condition, newVal), update(condition, newVal)

refresh 是 update的别名,作用相同,局部刷新(更新)UI

Note: The component is bound to getData to get the latest data state within the component

  • js
Page({
  data: {
    list: [],
  },
  onItemClick(data) {
    console.log(data)
  },
  getData({ detail }) {
    console.log(detail.result)
  },
  updateData({detail}) {
    const item = detail.id
    this.selectComponent('#waterfall').refresh({id: item.id}, val)
  },
})

Note *

If your data is likely to change state internally, you can update the UI using this.selectComponent(selector).refresh(condition, newVal)

this.selectComponent('#waterfall').refresh(condition, newVal)

you can get condition from item

  • wxss
.box {
  width: 100vw;
  height: 100vh;
  padding: 0 20rpx;
  box-sizing: border-box;
}

.item {
}

.item image {
  width: 100%;
}