Gathering detailed insights and metrics for px-rpx-vw-loader
Gathering detailed insights and metrics for px-rpx-vw-loader
npm install px-rpx-vw-loader
Typescript
Module System
Node Version
NPM Version
67.4
Supply Chain
99.2
Quality
75.7
Maintenance
100
Vulnerability
100
License
JavaScript (100%)
Total Downloads
1,584
Last Day
1
Last Week
6
Last Month
25
Last Year
274
4 Commits
1 Forks
2 Watching
1 Branches
1 Contributors
Minified
Minified + Gzipped
Latest Version
1.1.1
Package Id
px-rpx-vw-loader@1.1.1
Unpacked Size
7.67 kB
Size
3.35 kB
File Count
4
NPM Version
6.14.4
Node Version
14.1.0
Cumulative downloads
Total Downloads
Last day
-50%
1
Compared to previous day
Last week
-57.1%
6
Compared to previous week
Last month
177.8%
25
Compared to previous month
Last year
-1.1%
274
Compared to previous year
No dependencies detected.
px-rpx-vw-loader将项目中的rpx或者px单位转为vw,实现移动端自适应布局。
rpx的使用方法与微信小程序一样。
1// vue.config.js 配置文件 2module.exports = { 3 chainWebpack: (config) => { 4 config.module 5 .rule('rpx') 6 .test(/\.vue$/) 7 .use('px-rpx-vw-loader') 8 .loader('px-rpx-vw-loader') 9 .options({ 10 // 根据设计稿尺寸修改,默认是750(iPhone 6) 11 width: 750, 12 // 转换单位 13 unit: 'rpx', 14 // 转换比例 15 ratio: 1, 16 // 精度 17 unitPrecision: 6 18 }) 19 .end(); 20 } 21}
vue文件中的template、js和style样式表中的样式单位(rpx或者px),本loader均能实现转换为vw。
禁止使用如下形式:
1<div v-bind:style="{ color: activeColor, fontSize: fontSize + 'rpx' }"></div> 2data: { 3 activeColor: 'red', 4 fontSize: 30 5}
1<div v-bind:style="{ color: activeColor, fontSize: fontSize + 'px' }"></div> 2data: { 3 activeColor: 'red', 4 fontSize: 30 5} 6 7请修改为如下形式: 8```html 9<div v-bind:style="{ color: activeColor, fontSize: fontSize }"></div> 10data: { 11 activeColor: 'red', 12 fontSize: '30rpx' 13}
即不能将数值和rpx分离,否则loader无法解析。
1<div v-bind:style="{ color: activeColor, fontSize: fontSize }"></div> 2data: { 3 activeColor: 'red', 4 fontSize: '30px' 5}
即不能将数值和px分离,否则loader无法解析。
1<template> 2 <div class="root" v-bind:class="{ active: isActive }" v-bind:style="{ fontSize: fontSize }"></div> 3</template> 4<script> 5export default { 6 data() { 7 return { 8 isActive: true, 9 fontSize: '30rpx' 10 } 11 } 12}; 13</script> 14<style> 15.root{ 16 width:100%; 17 height:87rpx;/*设计高度是多少,此处就填写多少*/ 18} 19.active{ 20 font-size:20rpx; 21} 22</style>
or
1<template> 2 <div class="root" v-bind:class="{ active: isActive }" v-bind:style="{ fontSize: fontSize }"></div> 3</template> 4<script> 5export default { 6 data() { 7 return { 8 isActive: true, 9 fontSize: '30px' 10 } 11 } 12}; 13</script> 14<style> 15.root{ 16 width:100%; 17 height:87px;/*设计高度是多少,此处就填写多少*/ 18} 19.active{ 20 font-size:20px; 21} 22</style>
No vulnerabilities found.
Reason
no binaries found in the repo
Reason
0 existing vulnerabilities detected
Reason
license file detected
Details
Reason
Found 0/4 approved changesets -- score normalized to 0
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
no SAST tool detected
Details
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
security policy file not detected
Details
Reason
project is not fuzzed
Details
Reason
branch protection not enabled on development/release branches
Details
Score
Last Scanned on 2025-01-27
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More