我正在使用流路由器加載數據網格,但是當我查看頁面時,頁腳始終在數據加載之前閃爍到頂部。解決這個問題的最好方法是什麼?流量路由器頁腳在數據加載之前閃爍到頂部
這裏是路線:
AdminRoutes.route('/dashboard', {
name: 'adminDashboard',
action() {
BlazeLayout.render('AppLayout', {page: 'AdminDashboard'});
}
});
這裏是js文件:
import { Template } from 'meteor/templating'
import Stores from '../../../../api/stores/stores.js'
import './AdminDashboard.html'
Template.AdminDashboard.onCreated(function() {
var self = this;
self.autorun(function() {
self.subscribe('stores.names.links');
});
});
Template.AdminDashboard.helpers({
stores: function() {
return Stores.find();
}
});
下面是HTML佈局文件:
<template name='AppLayout'>
{{#if Template.subscriptionsReady}}
{{> Header }}
{{> Template.dynamic template=page}}
{{> Footer }}
{{/if}}
</template>
這裏是儀表板的html文件:
<template name='AdminDashboard'>
<div class='admin-dashboard-page'>
<section class='stores-grid'>
{{#each stores}}
<div class='store'>
<h2 class='store-name'>{{name}}</h2>
<a href='/admin/dashboard/{{link}}' class='store-button'>Edit</a>
</div>
{{/each}}
</section>
</div>
</template>
你是怎麼做的? – Rheisen
編輯第一個答案,希望它有幫助! – JaimeVelasco
它看起來像頁腳不再顯示和Template.Instance需要Template.instance不會得到錯誤的第一位 – Rheisen