rax-image
Advanced tools
Comparing version 1.0.0-miniapp.beta.7 to 1.0.0-miniapp.beta.8
@@ -17,30 +17,9 @@ import fmtEvent from '../_util/fmtEvent'; | ||
}, | ||
onInit() { | ||
this.initImage(); | ||
}, | ||
didMount: function didMount() { | ||
var mode = 'aspectFit'; | ||
const { width, height } = this.props.source || {}; | ||
let style = this.props.style || ''; | ||
if (width) style += 'width:' + width + 'rpx;'; | ||
if (height) style += 'height:' + height + 'rpx;'; | ||
switch (this.props.resizeMode) { | ||
case 'cover': | ||
mode = 'aspectFill'; | ||
break; | ||
case 'contain': | ||
mode = 'aspectFit'; | ||
break; | ||
case 'stretch': | ||
mode = 'scaleToFill'; | ||
break; | ||
default: | ||
mode = 'aspectFit'; | ||
if(!my.canIUse('component2')) { | ||
this.initImage(); | ||
} | ||
this.setData({ | ||
mode: mode, | ||
style: style | ||
}); | ||
}, | ||
@@ -51,4 +30,33 @@ methods: { | ||
this.props.onClick(event); | ||
}, | ||
initImage: function initImage(e) { | ||
var mode = 'aspectFit'; | ||
const { width, height } = this.props.source || {}; | ||
let style = this.props.style || ''; | ||
if (width) style += 'width:' + width + 'rpx;'; | ||
if (height) style += 'height:' + height + 'rpx;'; | ||
switch (this.props.resizeMode) { | ||
case 'cover': | ||
mode = 'aspectFill'; | ||
break; | ||
case 'contain': | ||
mode = 'aspectFit'; | ||
break; | ||
case 'stretch': | ||
mode = 'scaleToFill'; | ||
break; | ||
default: | ||
mode = 'aspectFit'; | ||
} | ||
this.setData({ | ||
mode: mode, | ||
style: style | ||
}); | ||
} | ||
} | ||
}); |
{ | ||
"name": "rax-image", | ||
"version": "1.0.0-miniapp.beta.7", | ||
"version": "1.0.0-miniapp.beta.8", | ||
"description": "Image component for Rax.", | ||
@@ -5,0 +5,0 @@ "license": "BSD-3-Clause", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
20706
178