Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/ttys026/wxapp-identicon
根据用户openID在小程序客户端随机生成SVG头像的插件.
https://github.com/ttys026/wxapp-identicon
javascript wxapp
Last synced: about 2 months ago
JSON representation
根据用户openID在小程序客户端随机生成SVG头像的插件.
- Host: GitHub
- URL: https://github.com/ttys026/wxapp-identicon
- Owner: ttys026
- License: mit
- Created: 2018-08-29T04:38:21.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2018-08-29T05:12:33.000Z (over 6 years ago)
- Last Synced: 2024-10-20T19:41:03.300Z (3 months ago)
- Topics: javascript, wxapp
- Size: 67.4 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# wxapp-identIcon
根据用户openID在小程序客户端随机生成SVG头像的插件.## 使用
1. clone project或者下载压缩包,因为小程序对代码量有<2M的要求,只需要拷贝dist目录下需要使用的Style到小程序目录中。
2. 在js文件中引用:
```
var IdentIcon = require('../../utils/githubStyle/index.js');
```3. 在js文件中使用:
```
var data = IdentIcon('openID');
this.setData({image: data});
```
上述例子中openID也可以替换成任意字符串。4.在wxml中插入图片:
``````
## 截图
#### Github style:
![github style](https://raw.githubusercontent.com/tli4/wxapp-identIcon/master/demo/github.png)
#### Robohash Style:
![robohash style](https://raw.githubusercontent.com/tli4/wxapp-identIcon/master/demo/robohash.png)
## Credits
#### HashTool from https://github.com/emn178/js-sha256
#### Github style revised from https://github.com/stewartlord/identicon.js
#### Robohash style revised from https://github.com/nimiq/robohash