我的流星應用程序有一個base.html文件的文件是這樣的:如何在流星中的幾個模板之間交替?
<head>
<title>MyApp</title>
</head>
<body>
<template name="bodyContent">
{{subContent}}
</template>
</body>
接下來,我定義了三個不同的模板:
<template name="templateA">Some text</template>
<template name="templateB">Bla bla bla</template>
<template name="templateC">Your highscore is {{score}}</template>
我怎樣才能讓{{子內容}}所以它能夠在運行時在這三個模板中的一個之間進行切換?
喜歡的東西:
currentTemplateUsed = 'templateB'
Template.bodyContent.subContent = Template[currentTemplateUsed]
但是,這並不工作。是否有其他方法來實現此功能?