rax-image
Advanced tools
Comparing version 2.0.1 to 2.0.2
@@ -35,5 +35,2 @@ "use strict"; | ||
}, | ||
onInit: function onInit() { | ||
this.initImage(); | ||
}, | ||
lifetimes: { | ||
@@ -44,2 +41,10 @@ attached: function attached() { | ||
}, | ||
observers: { | ||
styleSheet: function styleSheet(newStyleSheet) { | ||
this.initImage('styleSheet', newStyleSheet); | ||
}, | ||
source: function source(newSource) { | ||
this.initImage('srouce', newSource); | ||
} | ||
}, | ||
options: { | ||
@@ -61,4 +66,4 @@ styleIsolation: 'apply-shared' | ||
}, | ||
initImage: function initImage() { | ||
var _ref = this.properties.source || {}, | ||
initImage: function initImage(type, newValue) { | ||
var _ref = type === 'source' ? newValue : this.properties.source || {}, | ||
_ref$width = _ref.width, | ||
@@ -69,3 +74,3 @@ width = _ref$width === void 0 ? null : _ref$width, | ||
var style = this.properties.styleSheet || ''; | ||
var style = type === 'styleSheet' ? newValue : this.properties.styleSheet || ''; | ||
if (width) style += 'width:' + width + 'rpx;'; | ||
@@ -72,0 +77,0 @@ if (height) style += 'height:' + height + 'rpx;'; |
@@ -25,4 +25,4 @@ "use strict"; | ||
}, | ||
onInit: function onInit() { | ||
this.initImage(); | ||
deriveDataFromProps: function deriveDataFromProps(nextProps) { | ||
this.initImage(nextProps); | ||
}, | ||
@@ -34,2 +34,7 @@ didMount: function didMount() { | ||
}, | ||
didUpdate: function didUpdate() { | ||
if (!my.canIUse('component2')) { | ||
this.initImage(); | ||
} | ||
}, | ||
methods: { | ||
@@ -48,4 +53,6 @@ onClick: function onClick(e) { | ||
}, | ||
initImage: function initImage() { | ||
var _ref = this.props.source || {}, | ||
initImage: function initImage(nextProps) { | ||
var props = nextProps || this.props; | ||
var _ref = props.source || {}, | ||
_ref$width = _ref.width, | ||
@@ -56,3 +63,3 @@ width = _ref$width === void 0 ? null : _ref$width, | ||
var style = this.props.style || ''; | ||
var style = props.style || ''; | ||
if (width) style += 'width:' + width + 'rpx;'; | ||
@@ -59,0 +66,0 @@ if (height) style += 'height:' + height + 'rpx;'; |
{ | ||
"name": "rax-image", | ||
"version": "2.0.1", | ||
"version": "2.0.2", | ||
"description": "Image component for Rax.", | ||
@@ -5,0 +5,0 @@ "license": "BSD-3-Clause", |
@@ -31,5 +31,2 @@ import fmtEvent from './fmtEvent'; | ||
}, | ||
onInit() { | ||
this.initImage(); | ||
}, | ||
lifetimes: { | ||
@@ -40,2 +37,10 @@ attached: function() { | ||
}, | ||
observers: { | ||
styleSheet(newStyleSheet) { | ||
this.initImage('styleSheet', newStyleSheet); | ||
}, | ||
source(newSource) { | ||
this.initImage('srouce', newSource); | ||
} | ||
}, | ||
options: { | ||
@@ -57,5 +62,5 @@ styleIsolation: 'apply-shared' | ||
}, | ||
initImage() { | ||
const { width = null, height = null } = this.properties.source || {}; | ||
let style = this.properties.styleSheet || ''; | ||
initImage(type, newValue) { | ||
const { width = null, height = null } = type === 'source' ? newValue : this.properties.source || {}; | ||
let style = type === 'styleSheet' ? newValue : this.properties.styleSheet || ''; | ||
if (width) style += 'width:' + width + 'rpx;'; | ||
@@ -62,0 +67,0 @@ if (height) style += 'height:' + height + 'rpx;'; |
@@ -20,4 +20,4 @@ import fmtEvent from './fmtEvent'; | ||
}, | ||
onInit() { | ||
this.initImage(); | ||
deriveDataFromProps(nextProps) { | ||
this.initImage(nextProps); | ||
}, | ||
@@ -29,2 +29,7 @@ didMount() { | ||
}, | ||
didUpdate() { | ||
if (!my.canIUse('component2')) { | ||
this.initImage(); | ||
} | ||
}, | ||
methods: { | ||
@@ -43,5 +48,6 @@ onClick(e) { | ||
}, | ||
initImage() { | ||
const { width = null, height = null } = this.props.source || {}; | ||
let style = this.props.style || ''; | ||
initImage(nextProps) { | ||
const props = nextProps || this.props; | ||
const { width = null, height = null } = props.source || {}; | ||
let style = props.style || ''; | ||
if (width) style += 'width:' + width + 'rpx;'; | ||
@@ -48,0 +54,0 @@ if (height) style += 'height:' + height + 'rpx;'; |
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
31879
676
1