Skip to content

Commit

Permalink
feat(vue): not filter rpx when parse style
Browse files Browse the repository at this point in the history
  • Loading branch information
zealotchen0 committed Dec 9, 2024
1 parent 3deafcd commit 248accf
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
4 changes: 4 additions & 0 deletions driver/js/packages/hippy-vue-css-loader/src/css-parser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,10 @@ function convertPxUnitToPt(value: any) {
if (Number.isInteger(value)) {
return value;
}
// If value unit is rpx, don't need to filter
if (typeof value === 'string' && value.endsWith('rpx')) {
return value;
}
// If value unit is px, change to use pt as 1:1.
if (typeof value === 'string' && value.endsWith('px')) {
const num = parseFloat(value.slice(0, value.indexOf('px')));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,10 @@ function convertPxUnitToPt(value) {
if (Number.isInteger(value)) {
return value;
}
// If value unit is rpx, don't need to filter
if (typeof value === 'string' && value.endsWith('rpx')) {
return value;
}
// If value unit is px, change to use pt as 1:1.
if (typeof value === 'string' && value.endsWith('px')) {
const num = parseFloat(value.slice(0, value.indexOf('px')));
Expand Down

0 comments on commit 248accf

Please sign in to comment.