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

@fekit/mc-view

v1.1.2

Published

原生JS视图控制器

Downloads

1

Readme

@FEKIT/MC-VIEW

一款数据驱动的视图控制器原生JS版本,主要用于弹框,消息,单页路由的视图控制!

索引

演示

https://fekit.asnowsoft.com/plugins/mc-view

开始

下载项目:

npm i @fekit/mc-view

参数

{
  el: Element,           一个DOM元素,受控制显示隐藏的元素
  state: Number,         显示或隐藏的初始状态,如果设了watch数据监听,则这个不用 0:隐藏 1:隐藏(有动画) 2:显示(有动画) 3:显示
  on: {                  状态变化时的回调
    init(){},            插件初始化之后执行
    before(){},          显示隐藏之前执行
    show() {},           显示后执行(在动画完成后执行)
    hide() {},           隐藏后执行(在动画完成后执行)
    open() {},           显示后执行
    none() {},           隐藏后执行
  },
  ev: {                  绑定点击事件的元素
    show: Element,       点击要显示的元素(有动画的)
    hide: Element,       点击要隐藏的元素(有动画的)
    open: Element,       点击要显示的元素
    none: Element,       点击要隐藏的元素
  }
}

示例

import view from '@fekit/mc-view';

// 实例1
let aaa = {
  data: {
    content: null,
    active: 0
  },
  on: {
    before(showParam, _this) {
      const { view, data } = _this;
      if (showParam && view === 2) {
        data.content = document.querySelector('#content').children;
        let size = data.content.length;
        for (let i = 0; i < size; i++) {
          data.content[i].className = '';
        }
        data.content[showParam].className = 'on';
        data.active = showParam;
      }
    },
    show(showParam, _this) {
      console.log('显示了');
      console.log('第一个参数 showParam 是show的入参', showParam);
      console.log('第二个参数 _this 是这个构造函数对象', _this);
    },
    hide() {
      console.log('隐藏了');
    }
  },
  el: '#poetry',
  ev: {
    show: '.show_poetry',
    hide: '.hide_poetry'
  }
};
$bus.aaa = view(aaa);

// 显示(有动画)
$bus.aaa.show();
// 隐藏(有动画)
$bus.aaa.hide();

版本

v1.1.0
1. 完全重构插件,重新设计插件的使用方式与场景
v1.0.2
1. 完善文档
v1.1.0
1. 完成了核心功能

反馈

如果您在使用中遇到问题,请通过以下方式联系我。
email: [email protected]