流星拾色器

Meteor Color Picker

我正在尝试让 jscolor (http://jscolor.com/) 在我的 meteor 应用程序上运行。

jscolor.js javascript 文件位于:

client/lib/jscolor.js

现在,当我在我的 main.html 中放入带有 class jscolor 的输入元素时,例如:

<head>
  <title>Meteor Site</title>
</head>

<body>
   <input class="jscolor" value="ab2567">
</body>

有效!但是一旦我把它放在一个由铁路由器控制的模板中,例如设置:

<template name="settings">
    Settings
     <input class="jscolor" value="ab2567">
</template>

它什么都不做,它仍然是一个常规的输入字段。我需要以某种方式将 javascript 文件传递​​给模板还是需要将其设为全局?希望有人能帮助我吗?

        meteor add risul:bootstrap-colorpicker
html file
        <template name="hello">
          <input type="text" class="demo1" value="#5367ce" />
        </template>
js file
       Template.hello.rendered = function() {
         $('.demo1').colorpicker();
       }