2015-04-04 67 views
1

我是流星的新手。我有一个网站,我想转换成流星。我是否必须设置路由器,并更改所有链接?或者我可以使用在html页面之间导航的现有href链接吗?图像会成为问题吗?每个页面标题中的CSS和JavaScript都可以工作吗?流星:如何用网页,图片,链接等导入网站

回答

0

如果你有,你应该使用流星包iron:router定义它的路线,here is common tutorial

所以如果你有类似myUrl/about

你应该在流星这样做一些事情。

Router.route('about',function(){ 
    this.render('about') //and you should have a <template name="about></template> 
}) 

关于图像,你应该把图像/ public目录下,查看更多官方流星文档structuringmyapp

如果您的网络使用jQuery插件,你应该使用onRendered功能

Template.example.rendered(function(){ 
    //initialize jquery plugins 
}) 

这一切都因为喜欢你的问题说,你的路线,如果你没有路线。

如果您想在实时编辑器上测试,可以使用Meteorpad

我建议你阅读本书discoverMeteor或安装2 example from meteor,也Meteor tutorials Begginers它这里

-1

一个不错的选择添加iron:router路由您的网站。

// Router Example 
Router.configure({ 
    layoutTemplate: 'Layout' //Layout is a template for your website 
}); 

Router.map(function() { 
    this.route('index', {path: '/'}); // Index is an another template 
}); 

布局模板应该有{{> yield}}标签

<template name="Layout"> 
// Include header in separate template 
{{> yield}} 
// Include footed in separate template 
</template> 

<template name="index"> 
<!-- Page content --> 
</template> 

通过

Template.Layout.onRendered({ 
    //JQuery content HERE 
}); 

希望这将足以让简单的网站

执行JQuery的准备功能