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

@soei/flyweight

v0.1.2

Published

Vue组件, 列表de享元模式~减少DOM节点 flyweight

Downloads

290

Readme

安装

享元模式 Latest Version on NPM Software License npm npm bundle size

安装NPM Downloads by package author

<div style="height:100px;width:300px;">
  <!-- 确认父容器 宽 高 存在, 依赖父容器 `宽`, `高` 计算 -->
  <s-flyweight ...></s-flyweight>
</div>

安装

更新日志

0.1.1

  • 拼写错误修复

0.1.0

  • 新增 v-model:space 中字段

    {
      // --- 新增 ---
      // 总行数
      showrow,
      // 总列数
      showcolumn,
    
      // --- 原有 ---
      row, // 数据填充行数
      column, // 数据填前列数
    }
  • 修复了 多列数据时 @onend 回调函数问题

0.0.9

  • 问题修复 v-model:space 和 onend 冲突问题处理

0.0.8

  • 新增 v-model:space, 计算空间显示

    被通知对象 notice: {row, column}

    <!-- eg.
      当有5个元素, 
      当: :width="100% / 3", column = 3列, row = 2, 
      当: :width="100% / 5", column = 5列, row = 1,
      当: :width="100% / 7", column = 7列, row = 1
      ...
    -->
    <!-- VUE3 -->
    <template>
      <s-flyweight v-model:space="notice"></s-flyweight>
    </template>
    <script setup>
      let notice = ref({ row: 0, column: 0 });
      watch(
        () => notice.value,
        (val) => {
          console.log(val);
        }
      );
    </script>
    
    <!-- VUE2 -->
    <template>
      <s-flyweight :space.sync="notice"></s-flyweight>
    </template>
    <script>
      export default {
        data() {
          return {
            notice: { row: 0, column: 0 },
          };
        },
      };
    </script>

0.0.7

  • 新增 :auto, 默认值: false

autotrue 时, :width 赋值会被视为 最小值, 剩余空间自动填充

<s-flyweight :auto="true" :width="100"></s-flyweight>

0.0.6

  • 优化 flys 初始化赋值,不改变时,获取 length 问题

0.0.5

  • 扩展 width 赋值

    <!-- 添加`百分比`计算, 计算顺序, 左 => 右 -->
    <s-flyweight width="100% / 2 - 10px"></s-flyweight>
    <s-flyweight width="calc(100% - 100px)"></s-flyweight>
    <s-flyweight width="100% - 100px"></s-flyweight>
    <s-flyweight width="100px - 10px"></s-flyweight>
    <s-flyweight width="100px"></s-flyweight>
  • 优化了 slot end 的呈现逻辑

    <!-- onend为滑动到底时, 回调函数 -->
    <s-flyweight :flys="..." @onend="...">
      <template #default="{ data, index }"> 呈现内容 {{data.*}} </template>
      <template #end> ...显示在最下面的相关信息 </template>
    </s-flyweight>

0.0.3

  • 新增 :top

    <s-flyweight :top="滚动高度"></s-flyweight>

0.0.2

  • 优化了 Vue3兼容 问题

    Vue3 引入方式

    <script>
      import { Flyweight } from "@soei/flyweight";
    </script>
    <!-- 非 <style scoped>  scoped-->
    <style>
      @import "@soei/flyweight/dist/style.css";
    </style>

    源码引入

    import Flyweight from "@soei/flyweight/src/Flyweight.vue";

    // main.js
    import "@soei/flyweight/dist/style.css";
    import flyweight from "@soei/flyweight";
    Vue.use(flyweight);
    // use.vue
    <s-flyweight ...></s-flyweight>

安装

npm i @soei/flyweight

引用

// 引入方式 vue2
import Flyweight from "@soei/flyweight/src/Flyweight.vue";
// 引入方式 Vue3
import { Flyweight } from "@soei/flyweight";

使用

<Flyweight
  :index="0"
  :view="{id: Number, picker: 'id'}"
  :flys="list|Array"
  :width="80"
  :height="130"
  :offset="[0, 30]"
  @onend="Function"
>
  <template #default="{data, index}"> ...todo </template>
</Flyweight>
<Flyweight [attrs]></Flyweight>

indexview 只生效一个

index 定位索引

  // 格式
  Number;
  :index="10";

view 指定显示哪个索引

  // 格式
  {
    // 定位属性
    id: Number,
    // 定位属性字段名称
    picker: String
  }
  :view="{id: 10, picker: 'id'}";

flys 显示的数据列表

// 格式
Array;
:flys="[]";

width 单个容器 宽度

// 格式
Number;
// 默认: 0, 占整行
:width="100";

height 单个容器 高度

// 格式
Number;
// 默认: 100
:height="10";

offset 偏移量 [左右, 上下]

// 格式
Array = [左右, 上下];
:offset="[0, 30]";

@onend 拉到底部时的回调

// 格式
Function;
@onend="function(){}";