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

@roll2back/tool-weixin-mp

v0.0.4

Published

微信小程序工具

Downloads

7

Readme

时时工具包-微信小程序工具

安装方式

npm install @roll2back/tool-weixin-mp

功能说明

  • 请求封装为 httpServer 形式
  • 仓库封装为 store 调用
  • 事件实例化: Event
  • 跳转: goto、back
  • 自定义 wxs
  • 自定义脚手架
  • 同一定义样式

前序说明

下载依赖

  • npm install @roll2back/tool

初始化小程序

  • 使用 TS、scss 为小程序编程语言
  • 使用 Tdesign 作为 UI 组件库

小程序初始化操作

一、本地化 wxs 与脚手架

  • ./node_modules/.bin/weixin-mp-eject

二、修改根目录(可选)

  • 修改./package.json 的 scripts 中的 project 指令,把 miniprogram 修改为自定义项目名称

三、修改环境变量

  • 修改./cli/common.js 中的环境配置(allEnv 变量,填充好 appId、host 等)

四、初始化项目(生成项目配置文件、tsconfig.json)

  • npm run initp

五、构建 npm

  • 工具 -> 构建 npm

六、切换环境(生成环境变量)

  • npm run env:dev

七、在 app.[j|t]s 中初始化项目配置

  • 在 App 前面(非 App 内部)添加如下代码
import { startApp, hideApp } from '@/lib/index';
// 启动app
startApp();
  • 在 App 的钩子函数 onHide 添加代码:hideApp();
App<IAppOption>({
    ...
    onHide() {
        hideApp();
    }
});

八、导入公共样式

  • 在 app.[wx|sc]ss 中底一行添加如下样式
@import './miniprogram_npm/@roll2back/tool/wx.wxss';
@import './style/wr-iconfont/iconfont.wxss';

.t-tabs__item--active {
    font-weight: 400 !important;
}

九、配置 cli/common.js 中的 swaggerApi 字段,设置文档路径与基础信息获取接口

  • 修改./package.json 的 scripts 中的 document 指令,把 miniprogram 修改为自定义项目名称
  • 修改 ./cli/config/document.js 文件,修改文档组路径信息、系统基础信息的 url
npm run document

开发说明

创建表单页面

请求名称从请求的 service 文件中查找,请求添加名称一般是:xxxAdd,分页请求名称一般是:xxxGetPage

// yarn page:form [请求添加名称] [路径名称]
yarn page:form sysMessageAdd  /pages/index3

// yarn page:paging [请求分页名称] [路径名称]
yarn page:form sysMessageGetPage  /pages/index3
//

注意事项

页面路径变化需要执行: npm run route 进行更新路由文件(包括 tabar 列表)

app.json 内容变化为了保证格式一致性,也需要执行 npm run route 进行更新路由文件与 app.json 文件

app.json 中自定义 tabbar 时候,图标使用的 icon 字段

"tabBar": {
    "custom": true,
    "list": [
        {
            "selectedColor": "#000000",
            "text": "测试",
            "pagePath": "pages/index/index",
            "icon": "home"
        },
        {
            "selectedColor": "#000000",
            "text": "测试2",
            "pagePath": "pages/logs/logs",
            "icon": "user"
        }
    ]
}

初始化的部分包含 tabbar,如果不需要需要自定去除

··