├── .gitignore ├── LICENSE ├── README.md ├── assets ├── wxu.png └── wxu │ ├── authorize.gif │ ├── infiniteScroll.gif │ ├── popup.gif │ └── toast.gif ├── docs ├── README.md └── wxu │ ├── authorize.md │ ├── infiniteScroll.md │ ├── popup.md │ └── toast.md ├── package.json └── src ├── app.js ├── app.json ├── app.wxss ├── pages ├── authorize │ ├── authorize.js │ ├── authorize.json │ ├── authorize.wxml │ └── authorize.wxss ├── index │ ├── img │ │ ├── base64.js │ │ ├── icon_footer.png │ │ ├── icon_footer_link.png │ │ ├── icon_intro.png │ │ ├── icon_nav_feedback.png │ │ ├── icon_nav_form.png │ │ ├── icon_nav_nav.png │ │ ├── icon_nav_search.png │ │ ├── icon_nav_special.png │ │ ├── icon_nav_widget.png │ │ ├── icon_nav_z-index.png │ │ ├── icon_tabbar.png │ │ ├── logo.png │ │ ├── pic_160.png │ │ ├── pic_article.png │ │ └── vcode.jpg │ ├── index.js │ ├── index.wxml │ └── index.wxss ├── infiniteScroll │ ├── infiniteScroll.js │ ├── infiniteScroll.json │ ├── infiniteScroll.wxml │ └── infiniteScroll.wxss ├── popup │ ├── popup.js │ ├── popup.json │ └── popup.wxml └── toast │ ├── toast.js │ ├── toast.json │ └── toast.wxml └── wxu ├── authorize └── authorize.js ├── component.js ├── infiniteScroll ├── infiniteScroll.js ├── infiniteScroll.wxml └── infiniteScroll.wxss ├── popup ├── popup.js ├── popup.wxml └── popup.wxss ├── toast ├── toast.js ├── toast.wxml └── toast.wxss ├── wxu.js └── wxu.wxss /.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | .idea/* 3 | node_modules/ 4 | src/project.config.json -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2017 Zhang Yu 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # wxu for 小程序 2 | 3 | ## 概述 4 | 5 | [wxu](https://github.com/vincheung/wxu) 微信小程序 WeUI 的轻量级补充,及其他组件(Authorize)。 6 | 7 | 8 | ## 预览 9 | 用[微信web开发者工具](https://mp.weixin.qq.com/debug/wxadoc/dev/devtools/download.html)打开 `src` 目录(请注意,是 `src` 目录,不是整个项目)。 10 | 11 | preview 12 | 13 | preview 14 | 15 | preview 16 | 17 | preview 18 | 19 | preview 20 | 21 | 22 | ## 使用 23 | 24 | - 组件的 wxml 结构请看 `src/wxu/` 下的组件。 25 | - 样式文件可直接引用 `src/wxu/wxu.wxss`。 26 | 27 | 28 | ## 文档 29 | 30 | * [Toast - 提示框](https://github.com/vincheung/wxu/blob/master/docs/wxu/toast.md) 31 | * [Popup - 弹出框](https://github.com/vincheung/wxu/blob/master/docs/wxu/popup.md) 32 | * [InfiniteScroll - 无限滚动](https://github.com/vincheung/wxu/blob/master/docs/wxu/infiniteScroll.md) 33 | * [Authorize - 授权流程](https://github.com/vincheung/wxu/blob/master/docs/wxu/authorize.md) 34 | 35 | 36 | ## License 37 | 38 | The MIT License. 39 | 40 | 41 | ## 贡献 42 | 43 | 如果你有好的意见或建议,欢迎给我提 issue。 44 | -------------------------------------------------------------------------------- /assets/wxu.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/karl-cheung/wxu/3fa317d16d955fb634713eed4685f3f8d09afb40/assets/wxu.png -------------------------------------------------------------------------------- /assets/wxu/authorize.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/karl-cheung/wxu/3fa317d16d955fb634713eed4685f3f8d09afb40/assets/wxu/authorize.gif -------------------------------------------------------------------------------- /assets/wxu/infiniteScroll.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/karl-cheung/wxu/3fa317d16d955fb634713eed4685f3f8d09afb40/assets/wxu/infiniteScroll.gif -------------------------------------------------------------------------------- /assets/wxu/popup.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/karl-cheung/wxu/3fa317d16d955fb634713eed4685f3f8d09afb40/assets/wxu/popup.gif -------------------------------------------------------------------------------- /assets/wxu/toast.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/karl-cheung/wxu/3fa317d16d955fb634713eed4685f3f8d09afb40/assets/wxu/toast.gif -------------------------------------------------------------------------------- /docs/README.md: -------------------------------------------------------------------------------- 1 | # Summary 2 | 3 | - [Toast - 提示框](wxu/toast.md) 4 | - [Popup - 弹出框](wxu/popup.md) 5 | - [InfiniteScroll - 无限滚动](wxu/infiniteScroll.md) 6 | - [Authorize - 授权流程](wxu/authorize.md) -------------------------------------------------------------------------------- /docs/wxu/authorize.md: -------------------------------------------------------------------------------- 1 | 2 | 3 | # Authorize(options) 4 | 授权流程 5 | 6 | 参数 | 说明 | 类型 | 可选值 | 默认值 7 | --- | --- | --- | --- | --- 8 | scope | 需要获取权限的 scope | Array | 9 | success | 授权完成的回调函数 | Function 10 | 11 | 12 | ## 说明 13 | Authorize 方法在 onShow 生命周期函数中执行。 14 | 15 | 16 | **Example** 17 | 18 | ```js 19 | // 请注意无 AppID 关联下,此页面功能是受限的 20 | import { Authorize } from '../../wxu/wxu' 21 | 22 | Page({ 23 | onShow() { 24 | Authorize({ 25 | scope: ['scope.userInfo', 'scope.userLocation'], 26 | success: () => { 27 | this.init() 28 | } 29 | }) 30 | }, 31 | init() { 32 | this.setData({ 33 | success: '授权完成,执行 init 函数。' 34 | }) 35 | } 36 | }) 37 | ``` -------------------------------------------------------------------------------- /docs/wxu/infiniteScroll.md: -------------------------------------------------------------------------------- 1 | 2 | 3 | # InfiniteScroll(options) 4 | 无限滚动指令 5 | 6 | 参数 | 说明 | 类型 | 可选值 | 默认值 7 | --- | --- | --- | --- | --- 8 | name | 注册事件函数名 | String | 9 | msg | 触发时文本内容 | String | | 加载中... 10 | doneMsg | 结束时文本内容 | String | | 已无更多 11 | spinnerType | icon | String | fading-circle, snake | fading-circle 12 | className | 文本内容的自定义类名 | String 13 | 14 | 15 | ## 注册的事件函数中的api 16 | 完成此次加载:done() 17 | 18 | InfiniteScroll 结束:done(true) 19 | 20 | 21 | ## 说明 22 | 注意小程序上拉触底事件的处理函数 onReachBottom 执行条件需元素内容到达底部。 23 | 24 | 注册事件函数需传入 done 方法。 25 | 26 | 若希望 InfiniteScroll 组件在内容不足时总显示在窗口底部,请参考例子中的 Sticky footers 布局。 27 | 28 | 29 | **Example** 30 | 31 | ```html 32 | 33 | 34 | 35 | 36 | InfiniteScroll 37 | 无限滚动指令。 38 | 39 | 40 | {{ item }} 41 | 42 | 43 | 44 | 45 | 46 |