【发布时间】:2017-03-21 23:19:47
【问题描述】:
我正在尝试将此 npm 包 (https://www.npmjs.com/package/semantic-ui-calendar) 与 Meteor 一起使用,但在浏览器控制台中出现此错误:
来自 Tracker afterFlush 函数的异常:TypeError: $(...).calendar 不是函数
我尝试了以下安装来修复此错误:
npm i semantic-ui-calendar
npm semantic-ui-calendar --save
meteor npm i semantic-ui-calendar
meteor npm semantic-ui-calendar --save
我的代码:
blaze-html-模板:
<template name="myTemplate">
<h3>Date only</h3>
<div class="ui calendar" id="example2">
<div class="ui input left icon">
<i class="calendar icon"></i>
<input type="text" placeholder="Date">
</div>
</div>
<br/>
</template>
js-模板文件:
Template.myTemplate.onRendered(function() {
$(document).ready(function() {
$('#example2').calendar({
type: 'date'
});
});
});
还将此 JQuery 代码从 onRendered 移至帮助程序 - 没有成功。
【问题讨论】:
标签: meteor meteor-blaze semantic-ui