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 🙏

© 2026 – Pkg Stats / Ryan Hefner

@skydi/vuex

v1.0.2

Published

vue 下的VUEX辅助类

Readme

Vuex 辅助类

封装Vuex方法,使其在vue开发中,具有TypeScript风格

一.安装

yarn add @skydi/vuex

二.使用

1.创建文件

//创建文件 User.ts

//引入文件

import Vuex from "@skydi/vuex"

//创建类并添加上装饰器

@Vuex()
export default class User{

    //创建State
    Name:any = "leyozt"
    Age:any = 18

    //创建Getters 方法名必须是"G_"开头,必须全部大写。
    G_NAME(store:User){
        return store.Name
    }
    //创建Mutations 方法名必须是"M_"开头,必须全部大写。
    M_NAME(store:User,data:any){
        store.Name = data
    }
    //创建Actions 方法名必须是"A_"开头,必须全部大写。
    A_NAME(ctx:any,data:any){
        ctx.commit('M_USER_NAME',data)
    }

    G_AGE(store:User){
        return store.Age
    }
    M_AGE(store:User,data:any){
        store.Age = data
    }
    A_AGE(ctx:any,data:any){
        ctx.commit('M_USER_AGE',data)
    }
}

2.在Store/index.ts中初始化

//引用文件
import {store as Store} from "@skydi/vuex"
import User from "./User" //引入创建的文件

const store = Store({
    User,
})

declare let window:any
window.Store = store  //绑定到window上,方便在控制台中查询
export default store

3.在vue中使用

1)用Getter获取值

import { Getter } from "vuex-class"
@Getter("G_USER_NAME")  //注意:需要在 方法G_NAME中加入创建的类名User.
Name:any
@Getter("G_USER_AGE") 
Age:any

2)用this获取值

get Name(){
    return this.$store.state.User.Name
}

3) 调用 Actions 修改值

this.$store.dispatch(方法名必须大写,传递的数据)  //注意:需要在 方法G_NAME中加入创建的类名
this.$store.dispatch('A_USER_NAME','LEYOZT')

4)通过set_action 修改值

import {set_action} from "@skydi/vuex" //引入文件
set_action(文件类名,方法名,数据)
set_action('User','Name','LEYOZT')