残り火が初めてで、ベストプラクティスを理解しようとしています。問題は、カレンダー テンプレートに切り替えると、fullCalendar が 2 つのカレンダーをレンダリングすることです。
コンソール出力は次のとおりです。
Attempting transition to calendar ember.js?body=1:3499
Transition #3: calendar: calling beforeModel hook ember.js?body=1:3499
Transition #3: calendar: calling deserialize hook ember.js?body=1:3499
Transition #3: calendar: calling afterModel hook ember.js?body=1:3499
Transition #3: Resolved all models on destination route; finalizing transition. ember.js? body=1:3499
Rendering calendar with <app@view:calendar::ember635> Object {fullName: "view:calendar"} ember.js?body=1:3499
Transitioned into 'calendar' ember.js?body=1:3499
Transition #3: TRANSITION COMPLETE.
これが私のコードです:
router.es6
var Router = Ember.Router.extend({
location: 'history'
});
Router.map(function() {
//...
this.route('calendar');
//...
});
export default Router;
routes/calendar.es6
export default Ember.Route.extend();
ビュー/calendar.es6
var CalendarView = Ember.View.extend({
didInsertElement: function() {
$('#calendar').fullCalendar();
}
});
export default CalendarView;
templates/calendar.hbs
{{#view "calendar"}}
<nav>
<h1>Schedule</h1>
</nav>
<article id="schedule">
<section>
<div id='calendar'></div>
</section>
</article>
{{/view}}