您最多能選擇 25 個主題
主題必須以字母或數字為開頭,可包含連接號「-」且最長為 35 個字元。
23 行
495 B
23 行
495 B
4 年前
|
import { Template } from 'meteor/templating';
|
||
|
import { ReactiveVar } from 'meteor/reactive-var';
|
||
|
|
||
|
import './mainLayout.html';
|
||
|
import './templates/main_item.js'
|
||
|
import '/lib/router'
|
||
|
|
||
|
Template.hello.onCreated(function helloOnCreated() {
|
||
|
this.counter = new ReactiveVar(0);
|
||
|
});
|
||
|
|
||
|
Template.hello.helpers({
|
||
|
counter() {
|
||
|
return Template.instance().counter.get();
|
||
|
},
|
||
|
});
|
||
|
|
||
|
Template.hello.events({
|
||
|
'click button'(event, instance) {
|
||
|
instance.counter.set(instance.counter.get() + 1);
|
||
|
},
|
||
|
});
|