【发布时间】:2014-01-17 20:03:55
【问题描述】:
根据 Meteor 的文档,更改 #isolate 块内的内容不会导致父模板重新渲染,但我在以下示例中遇到不同的行为,当我更改时,'hello' 和 'a' 都会重新渲染'标题':
<head>
<title>testing</title>
</head>
<body>
{{> hello}}
</body>
<template name="hello">
{{#isolate}}
{{> a}}
{{/isolate}}
{{#isolate}}
{{> b}}
{{/isolate}}
</template>
<template name='a'>
a: {{title}}
</template>
<template name='b'>
b: {{desc}}
</template>
这里是javascript
if (Meteor.isClient) {
Template.hello.rendered = function () {
console.log('hello')
};
Template.a.rendered = function () {
console.log('a')
};
Template.b.rendered = function () {
console.log('b')
};
Handlebars.registerHelper('title', function() {
return Session.get('title');
});
Handlebars.registerHelper('desc', function() {
return Session.get('desc');
});
}
我是不是误解了什么?我在这里看到了一个类似但未回答的问题: Meteor: Changing a subtemplate without changing parent template
【问题讨论】:
标签: meteor handlebars.js