<head>
<title>bubblePop</title>
</head>
<body>
<center>{{> hello}}<center>
</body>
<template name="hello">
<h1>Bubble Pop!!!!</h1>
{{greeting}}
</template>
我知道它的基本原理是怎麼回事{{> hello}},所以你可以在任何地方插入{{> hello}},它將和模板中的一樣。但我正在嘗試使用JavaScript在我的流星應用上製作一張大桌子。我如何將我的代碼放在把手中?我可以在我的JS文件中使用<template>
嗎?只是有點困惑繼承人我的代碼的其餘部分: JS:試圖瞭解流星
if(Meteor.isClient) {
Meteor.startup(function(){
$(document).ready(function(){
var el;
for(var i=1; i<=64; i++){
el = document.createElement('div');
$(el).addClass('button');
$(el).on('click', function(){
$(this).addClass('removed');
});
$('#container').append(el);
}
});
})
<template name="bubbles">
</template>
Template.hello.greeting = function() {
}
Template.hello.events({
'click input' : function() {
// template data, if any, is available in 'this'
if (typeof console !== 'undefined')
console.log("You pressed the button");
}
});
}
if (Meteor.isServer) {
Meteor.startup(function() {
// code to run on server at startup
});
}
CSS:
#container {
width: 440px;
max-width: 440px;
}
#container > .button {
display: inline-block;
width: 50px;
height: 50px;
background-image: url('http://placehold.it/50x50');
margin-right: 5px;
margin-bottom: 5px;
opacity: 0.85;
transition: all 0.07s ease-in-out;
-moz-transition: all 0.07s ease-in-out;
-webkit-transition: all 0.07s ease-in-out;
cursor: pointer;
}
#container > .button:hover {
opacity: 1;
}
#container > .button.removed {
background-image: none;
}
我怎樣才能得到所有這些按鈕的出現?有一些我只是沒有得到
你看過這個嗎? http://www.discovermeteor.com/ – Homer6
我正在閱讀它我只是不知道我在做什麼。 – user3103599
第3章 - 模板可以很好地解釋你問的問題。 – sbking