【发布时间】:2017-11-29 00:16:52
【问题描述】:
我的 href 不起作用。 href 的链接在浏览器 (Chrome) 中正确显示,但没有呈现页面。在浏览器中点击刷新按钮后,页面正确呈现。
我不知道这是否重要,但我使用助手生成了 href-link,它是一个 MongoDB 数组。
这是我的数据:
{
"_id" : "n8usBgSfG8NQRwRxD",
"linkGenerator" : [
"ABC(8f6b1d521b7bd452)",
"ABC(c1348b440c15ec52)"
],
}
这是我的助手:
Template.link.helpers({
'unts': function() {
if (Meteor.userId()) {
var a = userManagement.find().fetch();
return a;
}
},
});
这是我的 HTML:
{{#each unts}}
<ul class="list-group">
{{#each linkGenerator}}
<li class="list-group-item">
<a href= "localhost:3000/link/{{this}}" target="_blank"> <span class="nav-label"></span>{{this}}</a>
</li>
{{/each}}
</ul>
{{/each}}
这是我的路线(铁路由):
Router.route('/link/:opened',{
waitOn: function() {
var params = this.params;
Session.set('opened', params.opened);
},
action: function() {
this.render('link');
this.layout('blankLayout');
},
});
我只是不知道为什么它不起作用,当我点击href时,但当我刷新页面时却可以正常工作。
【问题讨论】:
标签: javascript html meteor hyperlink routes