1 回答

TA貢獻(xiàn)1817條經(jīng)驗(yàn) 獲得超14個(gè)贊
希望這可以幫助任何人。
...
var that = this,
returnLetterTransform = () => {
const y = Math.random() * (15 - 6) + 6;
return 'translate3d(0,' + -y + 'vh,0)'
},
/* change to function
to get object dynamically
*/
letter = () => {
const transform = that.state.foldedLogo ? that.returnLetterTransform() : 'translate3d(0,0,0)';
return { transform: transform };
};
render() {
return(
/* call dynamic letter function */
... style={that.letter()} ...
... style={that.letter()} ...
...
);
}
添加回答
舉報(bào)