You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
16 lines
328 B
16 lines
328 B
2 years ago
|
/**
|
||
|
* 把style对象转换为能直接使用的字符串
|
||
|
*
|
||
|
* 如{display: none} => 'display:none;'
|
||
|
*/
|
||
|
export default function (styleObj) {
|
||
|
let styleStr = '';
|
||
|
Object.keys(styleObj).forEach((k) => {
|
||
|
if (styleStr != '') {
|
||
|
styleStr += ';';
|
||
|
}
|
||
|
styleStr += k + ':' + styleObj[k];
|
||
|
});
|
||
|
return styleStr;
|
||
|
}
|