对CSS这个方法改了一下,不加px也可以了
singod opened this issue · comments
for(k in property){
//此处为添加的
var prop = (typeof property[k]) == 'number' ? property[k] +'px' : property[k];
css += k+':'+prop+';';
};
此处我改成
for(k in property) css += k+':'+(type(property[k])==="Number"?property[k]+"px":property[k])+';';
if(typeof property == 'string'){ css = property+":"+value;}
//此处为添加的
if(typeof property == 'string' && typeof value == 'number'){ css = property+":"+value+"px";}
此处我改成
if(typeof property == 'string') css = property+":"+(type(value)==="Number"?value+"px":value);
取消了优化了,我没有考虑 z-index
的情况,还没有想好怎么处理。
不要加这个,更严格点,我认为更好
@yanhaijing 我也这么认为,好像是滴哦,得好好研究研究。