Skip to content

Commit adeae60

Browse files
committed
fix: 修复部分组件没有包裹combine
1 parent 1652eeb commit adeae60

File tree

4 files changed

+31
-5
lines changed

4 files changed

+31
-5
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@tarojs/parse-css-to-stylesheet",
3-
"version": "0.0.48",
3+
"version": "0.0.49",
44
"main": "index.js",
55
"types": "index.d.ts",
66
"napi": {

src/style_propetries/macros.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ macro_rules! generate_expr_lit_calc {
4343
let parsed_value: i32 = value[..value.len() - 2].parse().unwrap();
4444
if $platform == Platform::Harmony {
4545
if unit == "px" {
46-
return format!("${{{}({}, 'px')}}", CONVERT_STYLE_PX_FN, parsed_value);
46+
return format!("{}lpx", parsed_value);
4747
} else {
4848
return format!("${{{}({}, '{}')}}", CONVERT_STYLE_PX_FN, parsed_value, unit);
4949
}

src/style_propetries/unit.rs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,7 @@ pub fn generate_expr_by_length_value(length_value: &LengthValue, platform: Platf
3131
args.push(generate_expr_lit_num!(*num as f64))
3232
},
3333
Platform::Harmony => {
34-
handler = Some(CONVERT_STYLE_PX_FN.to_string());
35-
args.push(generate_expr_lit_num!(*num as f64))
34+
return generate_expr_lit_str!(format!("{}lpx", num))
3635
}
3736
}
3837
},
@@ -169,7 +168,9 @@ pub fn generate_expr_with_css_input(input: String, platform: Platform) -> Expr {
169168
"px" => {
170169
handler = match platform {
171170
Platform::ReactNative => Some(RN_CONVERT_STYLE_PX_FN.to_string()),
172-
Platform::Harmony => Some(CONVERT_STYLE_PX_FN.to_string())
171+
Platform::Harmony => {
172+
return generate_expr_lit_str!(format!("{}lpx", number))
173+
}
173174
};
174175
args.push(generate_expr_lit_num!(number));
175176
},

src/visitor.rs

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -661,6 +661,31 @@ impl VisitMut for ModuleMutVisitor {
661661
Decl::Fn(FnDecl { function, ..}) => {
662662
self.enable_nesting_for_function(function);
663663
}
664+
// export const Index = () => {}
665+
Decl::Var(var_decl) => {
666+
var_decl.decls.iter_mut().for_each(|decl| {
667+
match &mut decl.init {
668+
Some(init) => {
669+
match &mut **init {
670+
// export const Index = () => {}
671+
Expr::Arrow(ArrowExpr { body, .. }) => {
672+
self.enable_nesting_for_arrow_function(body);
673+
},
674+
// export const Index = withXxxx(() => {})
675+
Expr::Call(call) => {
676+
self.enable_nesting_for_call_expr(call);
677+
},
678+
// export const Index = function() {}
679+
Expr::Fn(FnExpr { function, .. }) => {
680+
self.enable_nesting_for_function(function);
681+
},
682+
_ => ()
683+
}
684+
},
685+
None => ()
686+
}
687+
})
688+
}
664689
_ => ()
665690
}
666691
},

0 commit comments

Comments
 (0)