Coder Social home page Coder Social logo

wx-tool's Introduction

wx-tool

微信小程序工具类集合,有效提高开发时间和效率!

另推荐云函数合集模板

重要:版本要求

  1. 小程序基础库版本 2.2.3 或以上
  2. 开发者工具 1.02.1808300 或以上开始,小程序支持使用 npm 安装第三方包。

使用微信开发者工具打开此项目,然后在项目根目录下运行:

npm install --production

安装好依赖包之后,点击工具顶部菜单栏的详情:

image

勾选“使用 npm 模块”选项:

image

最后点击开发者工具中的菜单栏:工具 --> 构建 npm 即可运行。

image

1.快速开始

    $ npm i wx-tool --save

2.按需引入

    var {
        showModal
    } = require('wx-tool')

3.使用例子

属性 类型 默认值 必填 说明
title string 提示的标题
content string 提示的内容
showCancel string true 是否显示取消按钮
cancelText string 取消 取消按钮的文字,默认为"取消",最多 4 个字符
cancelColor string #000000 取消按钮的文字颜色,默认为"#000000"
confirmText string 确定 确定按钮的文字,默认为"确定",最多 4 个字符
confirmColor string #00aaff 确定按钮的文字颜色,默认为"#00aaff"
    // 等同于 wx.showModal
    // 返回Promise
    showModal({
        title: `提示`,
        content: '支付成功',
        showCancel: false
    }).then((res)=>{
        console.log(res)
    })


    // 也可以使用 async/await
    async test(){
        try {
            let {
                confirm
            } = await showModal({
                title: '提示',
                content: `是否确认收货?`
            })
            if(confirm) {
                // 用户点击确认


                //你的代码....
            }
        } catch (error) {
            console.log(error)
        }
    }

API

wx-tool's People

Contributors

lxljl avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.