2015-04-04 69 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的準備功能