相关疑难解决方法(0)

关于守卫mixins的文档很少 - 为什么这个规则与任何mixins都不匹配?

在编写CSS时主要使用SASS,我现在正准备尝试LESS.通过文档阅读,我在保护mixins的上下文中与以下内容混淆:

此外,关键字true是唯一的truthy值,使这两个mixin等效:

.truth (@a) when (@a) { ... }
.truth (@a) when (@a = true) { ... }
Run Code Online (Sandbox Code Playgroud)

除关键字true之外的任何值都是假的:

.class {   
  .truth(40); // Will not match any of the above definitions.
}
Run Code Online (Sandbox Code Playgroud)

为什么truth(40)不匹配第一个mixin?when (@a)如果给出一个值(任何值)@a,基本上是否@a存在,是否只是声明只匹配mixin ?既然40存在一个值,为什么它在给定的mixins中找不到匹配?

css boolean-logic less

2
推荐指数
1
解决办法
625
查看次数

标签 统计

boolean-logic ×1

css ×1

less ×1