mirror of
https://github.com/actix/actix-website
synced 2024-11-27 10:02:57 +01:00
fix index page
This commit is contained in:
parent
88300abd1f
commit
a2d543f8bc
@ -211,12 +211,20 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="actix-showcase">
|
||||
<div class="col-md-9">
|
||||
<div class="actix-feature" id="responder">
|
||||
|
||||
|
||||
<div id="act-cn-tabs">
|
||||
<ul class="act-menu">
|
||||
<li id="one1" onclick="setTab('one',1)">灵活的请求响应</li>
|
||||
<li id="one2" onclick="setTab('one',2)">强大的Extractors</li>
|
||||
<li id="one3" onclick="setTab('one',3)">轻松处理表单</li>
|
||||
<li id="one4" onclick="setTab('one',4)">请求路由</li>
|
||||
</ul>
|
||||
<div id="content">
|
||||
<div id="con_one_1">
|
||||
<h2>灵活的请求响应</h2>
|
||||
<p>
|
||||
Actix中的Handler函数可以返回实现该Respondert rait的各种对象。这使得从API返回一致的响应变得轻而易举。
|
||||
Actix中的Handler函数可以返回实现该<code>Respondert</code> rait的各种对象。这使得从API返回一致的响应变得轻而易举。
|
||||
</p>
|
||||
{{ highlight `#[derive(Serialize)]
|
||||
struct Measurement {
|
||||
@ -231,7 +239,7 @@
|
||||
Json(Measurement { temperature: 42.3 })
|
||||
}` "rust" "" }}
|
||||
</div>
|
||||
<div class="actix-feature" id="extractor">
|
||||
<div id="con_one_2" style="display:none;">
|
||||
<h2>强大的Extractors</h2>
|
||||
<p>
|
||||
Actix提供了一个强大的提取器系统,可以从传入的HTTP请求中提取数据并将其传递给您的视图函数。这不仅可以创建方便的API,
|
||||
@ -249,7 +257,7 @@
|
||||
format!("got event {}", id)
|
||||
}` "rust" "" }}
|
||||
</div>
|
||||
<div class="actix-feature" id="forms">
|
||||
<div id="con_one_3" style="display:none;">
|
||||
<h2>轻松处理表单</h2>
|
||||
<p>
|
||||
处理multipart/ urlencoded表单数据很容易。只需定义一个可以反序列化的结构,actix就可以处理剩下的部分。
|
||||
@ -264,7 +272,7 @@
|
||||
format!("Hello {} from {}!", data.username, data.country)
|
||||
}` "rust" "" }}
|
||||
</div>
|
||||
<div class="actix-feature" id="route">
|
||||
<div id="con_one_4" style="display:none;">
|
||||
<h2>请求路由</h2>
|
||||
<p>
|
||||
一个actix应用程序带有一个URL路由系统,可以让你在URL上匹配并调用单个处理程序。为了获得额外的灵活性,可以使用域。
|
||||
@ -285,15 +293,10 @@
|
||||
}` "rust" "" }}
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-3 actix-feature-selectors">
|
||||
<ul>
|
||||
<li class="actix-feature-selector"><a href="#responder">灵活的请求响应</label>
|
||||
<li class="actix-feature-selector"><a href="#extractor">强大的Extractors</label>
|
||||
<li class="actix-feature-selector"><a href="#form">轻松处理表单</label>
|
||||
<li class="actix-feature-selector"><a href="#route">请求路由</label>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
@ -13,20 +13,7 @@
|
||||
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.1/jquery.min.js" integrity="sha384-3ceskX3iaEnIogmQchP8opvBy3Mi7Ce34nWjpBIwVTHfGYWQS9jwHDVRnpKKHJg7" crossorigin="anonymous"></script>
|
||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/tether/1.3.7/js/tether.min.js" integrity="sha384-XTs3FgkjiBgo8qjEjBk0tGmf3wPrWtA6coPfQDfFEY8AnYJwjalXCiosYRBIBZX8" crossorigin="anonymous"></script>
|
||||
<script src="/js/bootstrap.min.js"></script>
|
||||
<script src="/js/actix.js"></script>
|
||||
<script src="/js/actix.js" async></script>
|
||||
{{ template "_internal/google_analytics.html" . }}
|
||||
|
||||
<script type="text/javascript" async>
|
||||
window.onload = function(){
|
||||
if (window.location.href.indexOf("http://localhost:1314/cn/") == 0) {
|
||||
var actix_home = document.getElementById("act-home")
|
||||
actix_home.style.display = "none"
|
||||
}
|
||||
if (window.location.href.indexOf("http://localhost:1313/") == 0) {
|
||||
var actix_home_cn = document.getElementById("act-home-cn")
|
||||
actix_home_cn.style.display = "none"
|
||||
}
|
||||
}
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
|
@ -600,3 +600,27 @@ h5:hover a {
|
||||
width: 88%;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#act-cn-tabs {
|
||||
padding: 2rem 1.5rem 0.5rem 2rem;
|
||||
margin: 2rem auto;
|
||||
background:#dceaea;
|
||||
}
|
||||
|
||||
.act-menu{
|
||||
width: 24%;
|
||||
float: right;
|
||||
border-right:#cccccc solid 1px;
|
||||
}
|
||||
.act-menu li{
|
||||
text-align:center;
|
||||
line-height:44px;
|
||||
font-size:15px;
|
||||
overflow:hidden;
|
||||
}
|
||||
.act-menu li.off{
|
||||
background:#FFFFFF;
|
||||
color:#000000;
|
||||
font-weight:bold;
|
||||
}
|
@ -1,3 +1,30 @@
|
||||
window.onload = function(){
|
||||
if (window.location.href.search("cn") != -1) {
|
||||
var actix_home = document.getElementById("act-home")
|
||||
actix_home.style.display = "none"
|
||||
}else{
|
||||
var actix_home_cn = document.getElementById("act-home-cn")
|
||||
actix_home_cn.style.display = "none"
|
||||
}
|
||||
}
|
||||
|
||||
function setTab(name,cursel){
|
||||
let tlinks = document.getElementById("act-cn-tabs").getElementsByTagName('li')
|
||||
for(var i=1; i<=tlinks.length; i++){
|
||||
var menu = document.getElementById(name+i);
|
||||
var menudiv = document.getElementById("con_"+name+"_"+i);
|
||||
if(i==cursel){
|
||||
menu.className="off";
|
||||
menudiv.style.display="block";
|
||||
}
|
||||
else{
|
||||
menu.className="";
|
||||
menudiv.style.display="none";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
(function() {
|
||||
function activateFeature(sel) {
|
||||
$('div.actix-feature').hide();
|
||||
@ -36,3 +63,5 @@
|
||||
initFeatureSelector();
|
||||
});
|
||||
})();
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user