px2rpx | px转rpx
作者:互联网
转换脚本
const {exec} = require('child_process') const iconv = require('iconv-lite') let str = ` <style> .search-bar { height: 50px; } </style> ` let arr = [] let str2 = str.replace(/((\-|\+)?\d+(\.\d+)?)px/gim, s => { let px = s.replace('px', '') let px2 = parseFloat(px) * 2 return px2 + 'rpx' }) exec('clip').stdin.end(iconv.encode(str2.trim(), 'gbk')) console.log('===复制成功===', new Date().toLocaleString())
结果
<style> .search-bar { height: 100rpx; } </style>
本文地址
https://www.cnblogs.com/stumpx/p/15161063.html
===
标签:px2rpx,rpx,px,iconv,height,let,str2 来源: https://www.cnblogs.com/stumpx/p/15161063.html