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

usevuex

v0.0.1

Published

useVuex是用于提供类似mapState mapGetters mapActions mapMutations createNamespacedHelpers等vuex4.0拓展功能的辅助函数包

Downloads

11

Readme

useVuex

Introduce/简介

vuex 提供了一些类似mapState,mapMutations,createNamespacedHelpers等辅助函数给我们的开发带来了方便,但是在实际的开发过程中却发现vuex4.0对vue3得支持严重不足,特别是mapState,mapMutations,createNamespacedHelpers等辅助函数强烈依赖this所以几乎不能在setup中使用,另外vuex4.0对TypeScript的支持也十分有限,用到mutation,action等方法几乎成了AnyScript.纵观整个useStore的实现发现其十分依赖vue3的新特性Provide和Inject.这也导致目前并没有十分有效的方法解决这个问题,但是我认为使用泛型依然可以解决部分类型推断.故希望写此包尝试在vuex5.0公测前临时解决vuex4.0与vue3,TypeScript之间的矛盾.

UTC codes and abbreviations for Standard Time and Daylight Saving Time (DST) around the world.

Feature/特性:

  1. 加强vuex4.0对vue3的支持,主要是对Hook和setup方面的支持
  2. 增强vuex4.0对TypeScript的支持,增强类型推导
  3. 添加部分语法糖,使用法更简洁
  4. 使用Hook的风格保持代码风格一致

Usage/用法

参数说明 useStore(string|InjectionKey|undefined):Store useNamespacedStore(string|InjectionKey|undefined):{ useActions, useGetters, useMutations, useState }

引入包


//ES6 Module
import { useStore, useNamespacedStore } form "usevuex"

const { useActions, useGetters, useMutations, useState } = useNamespacedStore()
// or
const { useActions, useGetters, useMutations, useState } = useNamespacedStore(storeKey)

Notice/注意

一定要在setup函数或是使用了 语法糖的标签中使用.

Advance/优势

弥补官方vuex4.0对工具函数迟迟未能支持的问题,提供类型安全的ts版本.

Version/版本日志

  • ✅v0.0.1 发布useVuex包.
  • 🟩v0.0.X 修复潜在BUG