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

dd-common-packages

v1.0.13

Published

1. vue3 自定义指令

Downloads

101

Readme

common-packages - 公共包

  1. vue3 自定义指令

    1. dom 出现在视口区域内 side-in 渐入效果
    2. click-outside 点击指定 dom 以外的地方 执行回调
    3. img-lazy 图片懒加载 滑动到视口区域内才会加载 string| { success: string; error?: string; timeout?: number };
  2. vue3 props 的 hooks usePropsHook

    可以实现 父组件传过来的 props 用 hooks 包起来后 可以在子组件直接修改 会 emit 到付组件

    const filterData = usePropsHook(props, emit, "modelValue");
    filterData.value.k = 1;
    // 这个filterData 可以直接在子组件template里面直接使用
  3. useComponentRef 给组件设置 ref 这个 k 可以找到类型

    import QuestionList from "@/components/pages/question/QuestionList.vue";
    const k = useComponentRef(QuestionList);
  4. date 相关

  5. shared

    1. lodash cloneDeep, debounce, throttle

    2. 随机数 getRandomStr 多少位随机数 getRandomColor 获取随机颜色

    3. extends ClassExtends 提供多继承

      const d = new ClassExtends(B, C);
  6. tdk

  7. 浏览器相关

    1. addListener addEventListener 当页面卸载会自动 移除监听

    2. mutationObserver mutationObserver 直接dom.mutationObserver 会监听dom变化

      1. 第一个参数是回调

      2. 第二个参数是配置项 { attributes: true, childList: true, subtree: true } 默认 { subtree: false,childList: true, attributes: false, }

        • attributes:一个布尔值,表示是否观察目标节点或其子节点中属性的变化。如果为 true,则当目标节点或其子节点中的属性发生变化时,MutationObserver 对象将会被通知。

        • childList:一个布尔值,表示是否观察目标节点的子节点的变化。如果为 true,则当目标节点的子节点列表发生变化时(如添加、删除或移动子节点),MutationObserver 对象将会被通知。

        • subtree:一个布尔值,表示是否观察目标节点的所有后代节点(即包括它的子节点、孙子节点、曾孙节点等)。如果为 true,则当目标节点及其后代节点的任何变化发生时,MutationObserver 对象将会被通知。