如何制作Iron:路由器重新渲染模板?
我有这个HTML:
<head>
</head>
<body>
</body>
<template name="mainLayout">
<a href="{{pathFor route='list'}}">list</a>
<a href="{{pathFor route='find' query='q=xxx'}}">find</a>
{{> yield}}
</template>
<template name="listTemplate">
<p>list</p>
</template>
Run Code Online (Sandbox Code Playgroud)
这个js:
Router.configure({
layoutTemplate: 'mainLayout'
});
Router.route('/list', {
name: 'list',
template: 'listTemplate'
});
Router.route('/find', {
name: 'find',
template: 'listTemplate',
data: function () {
return this.params.query;
}
});
if (Meteor.isClient) {
Template.listTemplate.rendered = function () {
if (this.data)
console.log('find ' + this.data.q);
else
console.log('list all');
};
}
Run Code Online (Sandbox Code Playgroud)
当我单击链接切换视图(使用console.log模拟此处)时,路径确实会更改,但模板不会重新呈现.有没有办法强迫铁:路由器重新渲染?
使用Meteor 0.9.3和iron:路由器1.0.0-pre2,即使安装了iron:layout,也会在控制台上显示此错误,如下所示:
willems-mini:iron willem$ meteor add iron:router@=1.0.0-pre2
added iron:location at version 1.0.0-pre2
added iron:dynamic-template at version 1.0.0-pre2
added iron:router at version 1.0.0-pre2
added iron:layout at version 1.0.0-pre2
added iron:middleware-stack at version 1.0.0-pre2
added iron:url at version 1.0.0-pre2
added iron:controller at version 1.0.0-pre2
added iron:core at version 1.0.0-pre2
iron:router: Routing specifically designed for Meteor
Run Code Online (Sandbox Code Playgroud)
没有其他包,只是meteor的默认值:
willems-mini:iron willem$ meteor list
autopublish 1.0.0 Publish the entire database to all clients
insecure 1.0.0 Allow all database writes by default
iron:router 1.0.0-pre2 Routing specifically designed …
Run Code Online (Sandbox Code Playgroud) 我对如何使用Accounts.onEmailVerificationLink
.
文档有点模棱两可:
Accounts.onEmailVerificationLink(回调)
注册一个函数,当单击 Accounts.sendVerificationEmail 发送的电子邮件中的电子邮件验证链接时调用。这个函数 应该在顶级代码中调用,而不是在 Meteor.startup() 中。
“这个函数”、回调函数或Accounts.onEmailVerificationLink
它本身究竟是什么意思?
无论如何,无论我把东西放在哪里,我总是在浏览器控制台上收到此错误消息:
Accounts.onEmailVerificationLink was called more than once. Only one callback added will be executed.
Run Code Online (Sandbox Code Playgroud) {{#e}}}中{{#if}}的这个简单示例会产生意外(对我而言)结果:
HTML:
<head>
<title>test</title>
</head>
<body>
{{> test yes=true}}
</body>
template name="test">
{{#if yes}}
<span>yes</span>
{{else}}
<span>no</span>
{{/if}}
<ul>
{{#each testItems}}
{{#if yes}}
<li>yes</li>
{{else}}
<li>no</li>
{{/if}}
{{/each}}
</ul>
</template>
Run Code Online (Sandbox Code Playgroud)
JS:
Template.test.helpers({
testItems: [1,2,3]
});
Run Code Online (Sandbox Code Playgroud)
输出:
是
我期待一个3 x的列表是......
这段代码有什么问题?
我想在启动 Mac 时从 Synology NAS 自动挂载一些 NFS 共享。直到最近,我才开始工作:
/etc/auto_master:
+auto_master # Use directory service
/net -hosts -nobrowse,hidefromfinder,nosuid
/home auto_home -nobrowse,hidefromfinder
/Network/Servers -fstab
/- -static
/- auto_nfs -nobrowse,nosuid
/etc/auto_nfs:
/mnt/idefix/digikam -fstype=nfs,noowners,nolockd,resvport,hard,bg,intr,rw,tcp,nfc,rsize=8192,wsize=8192 nfs://idefix:/volume1/digikam
Run Code Online (Sandbox Code Playgroud)
现在,升级到 MacOS 10.15 (Catalina) 后,这不再起作用。我究竟做错了什么?
我想设置滑块各个部分的颜色,手柄和轨道的两个部分:手柄之前和之后。或者更好:使滑块不可见(但仍然有效),这样我就可以根据滑块值自己绘制一些东西......
我不认为当前可用的样式属性使我能够做到这一点?