[英]jQuery TokenInput with Meteor
How can I include jQuery TokenInput with the Meteor framework? 如何在Meteor框架中包含jQuery TokenInput? I couldn't find a smart package so now I am wondering how I can do it without needing a smart package.
我找不到一个智能包,所以现在我想知道如何在不需要智能包的情况下做到这一点。
For example how to include the jquery.tokeninput.js
? 例如,如何包含
jquery.tokeninput.js
?
As for coming up with a script that returns search results would I just use iron-router for that? 至于提出一个返回搜索结果的脚本,我会使用铁路由器吗?
And have a route that accepts a query string q
, then do a simple MyCollections.find({name: q} ....
? 并有一个接受查询字符串
q
的路由,然后做一个简单的MyCollections.find({name: q} ....
?
If would be great if someone could help me understand exactly how I can add this plugin to my app that's on Meteor's framework. 如果有人能帮我理解如何将这个插件添加到Meteor框架上的应用程序中,那将会很棒。
A possible way of doing this without the need of packaging is to put it in your client/lib/
folder. 在不需要打包的情况下执行此操作的可能方法是将其放在
client/lib/
文件夹中。
In this case it would be root_of_your_app/client/lib/jquery.tokeninput.js
, you can also put .css files in there. 在这种情况下,它将是
root_of_your_app/client/lib/jquery.tokeninput.js
,您也可以将.css文件放在那里。
I still think you should make a smart package out of it, but this should work. 我仍然认为你应该制作一个智能包,但这应该有效。
In terms of building the script, I think you're on the right track. 在构建脚本方面,我认为你走在了正确的轨道上。
Make sure you use .fetch()
to return the results in an array, and then possibly use JSON.stringify(array)
to get the right format. 确保使用
.fetch()
将结果返回到数组中,然后可能使用JSON.stringify(array)
来获得正确的格式。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.