样式值可以是浮动的, 客户端代码可能需要舍入为整数像素。
langx.toPixel(value)
Example: “34 45 66”需被解析值,解析后值为 34。
<!DOCTYPE html> <html> <head> <style> </style> <script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/require.js/2.3.3/require.min.js"></script> <script> require.config({ baseUrl: "./", packages: [{ name: "skylark", location: "../../../src/skylark" }, ] }); </script> </head> <body> "34 45 66" toPixel . result <b></b> <script> require(["skylark/finder", "skylark/langx", "skylark/datax"], function(finder, langx, datax) { datax.text(finder.find("b"), langx.toPixel("34 45 66")); }); </script> </body> </html>