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

aya-store

v0.0.4

Published

小程序状态管理模块

Downloads

21

Readme

aya-store

一、使用前 Before Using:

在微信小程序的根目录下,输入

npm init

让npm托管小程序根目录(如果已经被npm覆盖,则不需要)

⚠️ Q:为什么要这样?

A: 因为小程序对于运行时npm有限制,需要此包必须存在于小程序根目录的node_modules下,而不能是大部分项目的src目录,所以需要先将根目录托管给npm,方便正确引入第三方npm以及完成微信开发者工具的构建工作。

二、安装 Installation:

1, 在小程序根目录下输入:

npm install aya-store --save

2, 点击微信开发者工具右上方的【详情】-> 勾选【使用npm模块】

Image text

3, 点击微信开发者工具上方任务栏中的【工具】-> 选择【构建npm】

Image text

这时候小程序根目录下应有miniprogram_npm/aya-storenode_modules/aya-store两个文件夹,则表示安装成功

三、使用 How to Use:

1, 导入aya-store模块:

// app.js 

import $Store from 'aya-store';

2, 创建一个aya-store实例,绑定到getApp()上:

// app.js

// 🌟创建store实例
const store = new $Store();

App({
    // 🌟挂载到getApp()
    store: store,
 
    // app.js自带内容
    onLaunch: function () {}

})

3, 创建store,作为每个页面/组件所要使用的目的store:

// 比如index.store.js

// 🌟创建对应store
export default class IndexStore {

    // 关键属性values,表示将其中的值交给aya-store进行观测,也就是index页面所需要用到的状态的值。
    values = {
        testArr: [],
        currStore: 0
    }

}

4, 在index页面,使用link()方法关联刚才创建的IndexStore状态器:

// index.js

// 🌟导入IndexStore
import IndexStore from './index.store';

const store = getApp().store;

// 🌟使用关键方法link()进行将页面与状态进行关联
Page(store.link(IndexStore, {
    data: {},
    onLoad: function () {}
    // and so on...
})

四、详细文档和APIs

文档 documents

五、使用案例 example:

  • 小程序脚手架:mina-gulp-cli

  • 小程序:Artifactory

  • waiting for more...

六、协议 Licenses

GitHub license

LICENSE 996.icu