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

qj-mini-pages-new

v1.3.20

Published

千匠星云小程序公共页面封装

Downloads

5

Readme

千匠星云小程序公共页面库

适用于千匠星云uni-app项目,easycom模式,打包时自动剔除没有使用的组件,无需担心全局引入体积大的问题。

安装

npm i qj-mini-pages

项目中配置

第一步 main.js

import qjMini from 'qj-mini-pages';

Vue.use(qjMini); 

第二步 pages.json

{
    "easycom": {
        "^qj-mini-(.*)": "qj-mini-pages/components/qj-mini-$1/qj-mini-$1.vue"
    }
}

第三步 App.vue

onLaunch(){
    // 接口请求域名
    this.$qj.domain = this.$domain;
    // 图片域名
    this.$qj.imgDomain = this.$imgDomain;
    // 业务域名
	this.$qj.businessDomain = this.$businessDomain;
    // 自定义Date方法(具体API见下方)
    this.$qj.addDatePrototypes();
	// Object方法
    this.$qj.addObjectPrototype();
	// String方法
    this.$qj.addStringPrototype();
}

至此可以使用公共页面以及公共JS方法。

提供常用API

this.$qj.router

  • 打开一个新页面

    this.$qj.router.push(url, query, { success, fail, complete, stay } = {})

  • 关闭当前页面,打开一个新页面

    this.$qj.router.replace(url, query, { success, fail, complete, stay } = {})

  • 关闭所有页面,打开一个新页面

    this.$qj.router.reOpen(url, query, { success, fail, complete, stay } = {})

  • 返回上一个页面

    this.$qj.router.back(delta = 1, query, { success, fail, complete, stay = 0 } = {})

    | 参数 | 类型 | 是否必传 | 解释 | | :---: | :---: | :---: | :---: | | url | String | 是 | 页面路径 | | query | Object | 否 | 页面传参 | | success | Function | 否 | 接口调用成功的回调函数 | | fail | Function | 否 | 接口调用失败的回调函数 | | complete | Function | 否 | 接口调用结束的回调函数 | | stay | Number | 否 | 跳转延迟时间 | | delta | Number | 否 | 返回的页面数 |

  • 注意,传入的url应该是去掉最前面的 ‘pages’ 和最后面的 ‘main’

this.$qj.storage

  • 从本地缓存中同步获取指定key对应的内容

    this.$qj.storage.get(key)

  • 将value存入本地缓存指定的key中,会覆盖掉原来key对应的内容,同步方法

    this.$qj.storage.set(key, value)

  • 移除本地缓存中key,同步方法

    this.$qj.storage.remove(key)

    | 参数 | 类型 | 是否必传 | 解释 | | :---: | :---: | :---: | :---: | | key | String | 是 | 指定的key | | value | String | 是 | key对应的内容 |

this.$qj.message

  • 弹窗(uni.showToast)

    this.$qj.message.alert(title, )