4 개 라인을 정의 템플릿을 찾을 수없는이 코드 :유성 나중에
//hello.js
import { Meteor } from 'meteor/meteor';
import { Template } from 'meteor/templating';
import './hello.html';
Template.hello.onCreated(function helloOnCreated() {
// counter starts at 0
this.counter = new ReactiveVar(0);
});
Template.hello.helpers({
counter() {
return Template.instance().counter.get();
},
});
Template.hello.events({
'click button'(event, instance) {
// increment the counter when button is clicked
instance.counter.set(instance.counter.get() + 1);
},
});
<!-- hello.html -->
<body>
<h1>Welcome to Meteor!</h1>
{{> hello}}
{{> info}}
</body>
<template name="hello">
<button>Click Me</button>
<p>You've pressed the button {{counter}} times.</p>
</template>
<template name="info">
<h2>Learn Meteor!</h2>
<ul>
<li><a href="https://www.meteor.com/try" target="_blank">Do the Tutorial</a></li>
<li><a href="http://guide.meteor.com" target="_blank">Follow the Guide</a></li>
<li><a href="https://docs.meteor.com" target="_blank">Read the Docs</a></li>
<li><a href="https://forums.meteor.com" target="_blank">Discussions</a></li>
</ul>
</template>
반환이 오류 :
Error: No such template: hello
at lookup.js:189
at Blaze.View.<anonymous> (spacebars-runtime.js:32)
at view.js:199
at Function.Template._withTemplateInstanceFunc (template.js:465)
at view.js:197
at Object.Blaze._withCurrentView (view.js:538)
at viewAutorun (view.js:196)
at Tracker.Computation._compute (tracker.js:311)
at new Tracker.Computation (tracker.js:201)
at Object.Tracker.autorun (tracker.js:576)
가 터무니없이 긴 얻기 위해이를 방지하기 위해, 필요한 경우 여기 GitHub repo입니다.
tutorial에서 서식 파일은 호출 후에옵니다. 그러나 웬일인지, 그것은 나의 페이지 위에 없을 것이다. 템플릿을 통화 위에 놓으면 작동하지만 이후에는 작동하지 않습니다. 내가 뭘 잘못하고 있는지 모르겠다.
다음은 요청 된 디렉토리 구조입니다. 나는 방금이 프로젝트를 시작했고, 안녕하세요.
디렉토리 구조를 확인해야 할 수도 있습니다. Meteor에는 클라이언트 측 가져 오기 순서에 대한 몇 가지 규칙이 있습니다. – ilrein
@ilrein 디렉토리 구조를 추가했습니다. 더 많은 정보가 필요하시면 알려주십시오. – amflare