Skip to content

Commit

Permalink
~ 精度
Browse files Browse the repository at this point in the history
  • Loading branch information
cloudcome committed Oct 26, 2016
1 parent e34579e commit 57fea58
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "blear.core.attribute",
"version": "1.0.2",
"version": "1.0.3",
"description": "DOM 属性",
"scripts": {
"live": "browser-sync start --config bs-config.js",
Expand Down
2 changes: 2 additions & 0 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,8 @@ var css = exports.css = function (cssKey, cssVal) {

// width: 100 => width: 100px
if (rePx.test(_cssKey) && validator.isNumber(_cssVal)) {
// 保留2位小数,防止设置的时候失真,导致设置失败
_cssVal = (_cssVal * 1).toFixed(2);
_cssVal += 'px';
}

Expand Down

0 comments on commit 57fea58

Please sign in to comment.