我了解当@observable
任一变量或属性的值发生变化时,变量或属性将能够与 HTML 对应项同步。
我没有得到的是@observable
功能的目的/意义一般和随意的 例子:
@observable bool show() {
if (sillyword != '' && adjective != '' &&
animal != '' && bodypart != '' &&
verb != '' && adverb != '') {
return true;
} else {
return false;
}
}
及其对应的 HTML:
<template instantiate="if show()">
<p>Dear Ms. {{sillyword}},</p>
<p>Little {{adjective}} Billy missed school
because he was sick with wild-{{animal}} flu.
His {{bodypart}} swelled up and fell off.
He can no longer {{verb}}.</p>
<p>Most {{adverb}} yours, Billy's mother</p>
</template>
以及在什么样的情况下@observable
功能是有用的?