Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/billyma128/wepy-img-loader
A fork of wxapp-img-loader(https://github.com/o2team/wxapp-img-loader)
https://github.com/billyma128/wepy-img-loader
Last synced: about 2 months ago
JSON representation
A fork of wxapp-img-loader(https://github.com/o2team/wxapp-img-loader)
- Host: GitHub
- URL: https://github.com/billyma128/wepy-img-loader
- Owner: billyma128
- License: mit
- Created: 2017-01-14T08:09:55.000Z (almost 8 years ago)
- Default Branch: master
- Last Pushed: 2017-01-15T04:42:20.000Z (almost 8 years ago)
- Last Synced: 2024-09-08T10:46:38.681Z (4 months ago)
- Language: JavaScript
- Homepage:
- Size: 3.91 KB
- Stars: 22
- Watchers: 2
- Forks: 3
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-wepy - wepy-img-loader:微信小程序wepyjs第三方图片预加载组件
README
# 微信小程序 wepyjs 第三方图片预加载组件
## 说明
[wxapp-img-loader](https://github.com/o2team/wxapp-img-loader)只能用于小程序原生开发,因此需要一个适用于[wepy](https://github.com/wepyjs/wepy)使用的组件。## 使用
### 安装组件
```
npm install wepy-img-loader --save
```### 引入组件
``` javascript
// index.wpy
import wepy from 'wepy';
import ImgLoader from 'wepy-img-loader';export default class Index extends wepy.page {
components = {
imgloader: ImgLoader
}
}```
### 调用方法
``` javascript
//缩略图 80x50 3KB
const imgUrlThumbnail = 'http://storage.360buyimg.com/mtd/home/lion1483683731203.jpg'
//原图 3200x2000 1.6MB
const imgUrlOriginal = 'http://storage.360buyimg.com/mtd/home/lion1483624894660.jpg'this.msg = '大图正在拼命加载...'
this.imgUrl = imgUrlThumbnailthis.$invoke('imgloader', 'load', imgUrlOriginal, (err, data) => {
this.msg = '大图加载完成~'
if (!err) {
this.imgUrl = data.src
}
this.$apply()
})
```## Thanks
### [wepy](https://github.com/wepyjs/wepy)
### [wxapp-img-loader](https://github.com/o2team/wxapp-img-loader)