本文共 657 字,大约阅读时间需要 2 分钟。
如何安装svelte
I had the need to dynamically apply some properties to an element, using , when one of its variables had a particular value.
当一个变量具有特定值时,我需要使用将某些属性动态地应用于元素。
The simplest solution I found was to add an HTML class when the selected
variable value was true
, and then I wrote some CSS that targeted that element with the class:
我找到的最简单的解决方案是,当selected
变量的值为true
时,添加一个HTML类,然后我编写了一些针对该元素CSS类:
{value}
This kind of need is so common that Svelte added the ability to bind the class name to a variable value:
这种需求非常普遍,以至于Svelte添加了将类名绑定到变量值的功能:
{value}
and in a more concise way, using the shorthand notation:
并以一种简明的方式使用速记符号:
{value}
翻译自:
如何安装svelte
转载地址:http://samgb.baihongyu.com/