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

components-mediator

v3.0.3-alpha

Published

Intermediator for Interaction between VUE Components

Downloads

4

Readme

ComponentsMediator

npm version VUE组间(事件中心) #Log 2022年11月4日 现已经支持vue3.0,vue2.X依然可用

加入依赖

npm i components-mediator 或是 cnpm i components-mediator

安装模块

import ComponentMediator from "components-mediator" //组件管理器

##使用方法

功能组件是安装在全局的,会绑定到VM对像上,也就是当前节点树的每一个节点;

我们在组件上使用他

结构层级嵌套

components-mediator
          components-mediator
                    components-mediator
  1. 需要激活当前节点的管理器,才可以管理自身及子节点
  ...
  created() {
    this.createComponentsMediator();//激活当前节点
  },
  ...

激活:会在当前节点注册,三个事件:register(注册方法),send(触发对应的已经注册的方法),remove(删除对应的UID下的所有注册)

  1. 注册方法 context Object 上下文环境 'register' String 关键字 options Object 注册的信息
{}type:指定注册的事件,用于send时触发对应的事件
uid:当前组件的uid,//this._uid,用于删除,
fn:触发器回调函数}
this.emits(context,'register',{
  type:'init',
  uid:this._uid,
  fn:(val)=>{
    console.log(val);
  }
})
  1. 触发方法 context Object 上下文环境 'send' String 关键字 registerType String 已经注册过的触发关键字,下面这个的触发关键字是init ...params

this.emits(this.$root,'send','init',params1,params2);