You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
hunjianghu/江可飞/小程序开发/html-view/each/qiniuImg.js

13 lines
419 B

6 years ago
// 七牛图片裁剪
const { pixelRatio, windowWidth } = wx.getSystemInfoSync()
const width = pixelRatio * windowWidth
module.exports = (domain, quality) =>
item => {
if (item.tagName === 'img' && item.attributes.src.indexOf(domain) !== -1 && item.attributes.src.indexOf('?') === -1) {
item.attributes.src += '?imageView2/2/w/' + width
if (quality) item.attributes.src += '/q/' + quality
}
}