Svelte 语句
我们不仅提供了声明反应式的 值,我们还可以运行反应式的 语句。例如,当 count 的值改变时就输出到日志中:$: console.log(the count is ${count}
);你可以轻松地将一组语句组合成一个代码块:$: {
console.log(the count is ${count}
);
alert(I SAID THE COUNT IS ${count}
);
}你甚至可以将 $: 放在= if 代码块前面:$: if (count >= 10) {
alert(count is dangerously high!
);
count = 9;
}