handlebar

阅读 / 问答 / 标签

handlebars中文歌词

I can ride my bike with no handlebars 我可以在我的单车上放开双手 我可以在我的单车上放开双手 No handlebars 放开双手 No handlebars 放开双手 I can ride my bike with no handlebars 我可以在我的单车上放开双手 No handlebars No handlebars 放开双手 放开双手Look at me, look at me 看看我,看看我hands in the air like it"s good to be ALIVE 放在空中的双手仿佛「活着」是件值得欣喜的事 and I"m a famous rapper 彷佛我是一名当红的饶舌高手even when the paths"re all crookedy即使当所有通往这些事情的道路都已扭曲不堪 I can show you how to do-si-do我可以让你瞧瞧什么叫方块舞I can show you how to scratch a record 我可以让你瞧瞧我刮盘的技巧 (PS:刮盘为DJ常用的一种演出方式) I can take apart the remote control 我可以把一支遥控器拆开 And I can almost put it back together 也几乎可以把它完整无缺的再装回去 I can tie a knot in a cherry stem 我可以用舌头把樱桃梗打个漂亮的结 I can tell you about Leif Ericson 我可以告诉你关于莱佛.艾瑞克森的故事 (PS:第一个发现北美洲的北欧维京探险家) I know all the words to "De Colores" 我知道"De Colores"里的所有歌词 (PS:一首在西班牙语系区域里知名的传统民谣歌曲,在十六世纪时由西班牙人传入美洲) And "I"m Proud to be an American" 也很清楚"我因生为美国人为荣"这句歌词 (PS:这句歌词源自于美国乡村歌手Lee Greenwood的一首爱国歌曲"God Bless the USA") Me and my friend saw a platypus 我和我的朋友看见了一只鸭嘴兽 Me and my friend made a comic book 我和我朋友做了一本漫画书 And guess how long it took 猜猜看这花了多久的时间 I can do anything that I want cuz, look: 我可以做任何我想做的,因为,听着: I can keep rhythm with no metronome 我可以继续保持这节奏,就算没了节拍器 No metronome 没了节拍器 No metronome 没了节拍器 I can see your face on the telephone 我可以在电话上看见你的面容 On the telephone 在电话上 On the telephone 在电话上 Look at me, look at me 看看我,看看我 Just called to say that it"s good to be ALIVE 只要照着说:「活着」是件值得欣喜的事 In such a small world 在这个狭小的世界 All curled up with a book to read 所有人都得蜷曲身子,读着相同的书 I can make money open up a thrift store 我可以在赚大钱之后开设一间二手商店 I can make a living off a magazine 我不靠军火库依然可以过我的生活 I can design an engine sixty four miles to a gallon of gasoline 我可以设计一个可以加个一加仑汽油就能跑在六十四哩的引擎 I can make new antibiotics 我可以制造新型的抗生素 I can make computers survive aquatic conditions 我可以做出不怕泡水的电脑 I know how to run a business 我知道如何经营起一个企业 And I can make you wanna buy a product 我可以让你不断地对我们的新产品消费 Movers shakers and producers 所有位高权重者和产品制造者 Me and my friends understand the future 我和我的朋友看见了什么是未来 I see the strings that control the systems 我看到了一条轻易控制整个体制的细线 I can do anything with no assistance 我可以在不需要任何协助的状况下完成一切 I can lead a nation with a microphone 我可以用一支麦克风领导整个国家 With a microphone 一支麦克风 With a microphone 一支麦克风 I can split the atoms of a molecule 我可以分解一个分子里的所有原子 Of a molecule 一个分子 Of a molecule 一个分子 Look at me, look at me 看看我,看看我 Driving and I won"t stop 狂飙着而且绝不停下的我 And it feels so good to be Alive and on top 「活着」与在世界的巅峰是多么令人欣喜的事! My reach is global 我的势力在全世界 My tower secure 我的堡垒深深紧掩 My cause is noble 我的动机出于高贵 My power is pure 我的力量如此纯粹 I can hand out a million vaccinations 我可以施舍给他们无数的接种疫苗 Or let"em all die in exasperation 或者也可以让他们全陈尸在我的暴怒之下 Have"em all grilled leavin lacerations 让他们全在拷问后身上留下撕痕 Have"em all killed by assassination 让他们全在这场暗杀中丧生 I can make anybody go to prison 我可以决定谁该被丢进囹圄 Just because I don"t like"em and 仅仅因为我不喜欢他们 I can do anything with no permission 我可以做任何事完全不需要经过谁的允准 I have it all under my command 我要所有事情全都在我的掌控之下 I can guide a missile by satellite 我可以用卫星来导航飞弹 By satellite 用卫星 By satellite 用卫星 and I can hit a target through a telescope 我也可以用望远镜来看着它击中目标 Through a telescope 用望远镜 Through a telescope 用望远镜 and I can end the planet in a holocaust 我更可以让这个星球在一场大屠杀后终结 In a holocaust 一场大屠杀 In a holocaust 一场大屠杀 In a holocaust 一场大屠杀 In a holocaust 一场大屠杀 In a holocaust 一场大屠杀 In a holocaust 一场大屠杀 I can ride my bike with no handlebars 我可以在我的单车上放开双手 No handlebars No handlebars 放开双手 放开双手I can ride my bike with no handlebars 我可以在我的单车上放开双手 No handlebars No handlebars 放开双手 放开双手

MVC中加入handlebars模板,后再模板中使用@html.raw无效怎么解决?在线等.....

Handlebars 是 JavaScript 一个语义模板库,通过对view和data的分离来快速构建web模板。它采用"Logic-less template"(无逻辑模版)的思路,在加载时被预编译,而不是到了客户端执行到代码时再去编译,这样可以保证模板加载和运行的速度。Handlebars兼容Mustache,你可以在Handlebars中导入Mustache模板。使用与安装Handlebars的安装非常简单,你只需要从github下载最新版本,你也可访问下面网址获取最新信息:http://handlebarsjs.com。目前handlebars.JS已经被许多项目广泛使用了,handlebars是一个纯js库,因此你可以像使用其他JS脚本一样用script标签来包含handlebars.js<script type="text/javascript" src=".js/handlebars.js"></script> 基本语法Handlebars expressions 是handlebars模板中最基本的单元,使用方法是加两个花括号{{value}}, handlebars模板会自动匹配相应的数值,对象甚至是函数。例如:<div class="demo"> <h1>{{name}}</h1> <p>{{content}}</p></div> 你可以单独建立一个模板,ID(或者class)和type很重要,因为你要用他们来获取模板内容例如:<script id="tpl" type="text/x-handlebars-template"> <div class="demo"> <h1>{{title}}</h1> <p>{{content.title}}</p> </div></script> handlebars会根据上下文来自动对表达式进行匹配,如果匹配项是个变量,则会输出变量的值,如果匹配项是个函数,则函数会被调用。如果没找到匹配项,则没有输出。表达式也支持点操作符,因此你可以使用{{content.title}}这样的形式来调用嵌套的值或者方法,handlebars会根据当前上下文输出content变量的title属性的值。在JavaScript中,使用Handlebars.compile()方法来预编译模板例如:(这是一套规则) //用jquery获取模板 var tpl = $("#tpl").html(); //原生方法 var source = document.getElementById("#tpl").innerHTML; //预编译模板 var template = Handlebars.compile(source); //模拟json数据 var context = { name: "zhaoshuai", content: "learn Handlebars"}; //匹配json内容 var html = template(context); //输入模板 $(body).html(html);Handlebar的表达式Block表达式有时候当你需要对某条表达式进行更深入的操作时,Blocks就派上用场了,在Handlebars中,你可以在表达式后面跟随一个#号来表示Blocks,然后通过{{/表达式}}来结束Blocks。如果当前的表达式是一个数组,则Handlebars会“自动展开数组”,并将Blocks的上下文设为数组中的元素。例如:<ul> {{#programme}} <li>{{language}}</li>{{/programme}}</ul> 有以下JSON数据{ programme: [ {language: "JavaScript"}, {language: "HTML"}, {language: "CSS"} ]}编译模板代码同上……上面的代码会自动匹配programme数据并展开数据,渲染DOM后就是这样的<ul> <li>JavaScript</li> <li>HTML</li> <li>CSS</li></ul> Handlebars的内置块表达式(Block helper)1.each block helper你可以使用内置的{{#each}} helper遍历列表块内容,用this来引用遍历的元素例如:<ul> {{#each name}} <li>{{this}}</li> {{/each}}</ul> 对应适用的json数据{ name: ["html","css","javascript"]};这里的this指的是数组里的每一项元素,和上面的Block很像,但原理是不一样的这里的name是数组,而内置的each就是为了遍历数组用的,更复杂的数据也同样适用。2.if else block helper{{#if}}就你使用JavaScript一样,你可以指定条件渲染DOM,如果它的参数返回false,undefined, null, "" 或者 [] (a "falsy" value),Handlebar将不会渲染DOM,如果存在{{#else}}则执行{{#else}}后面的渲染例如:{{#if list}}<ul id="list"> {{#each list}} <li>{{this}}</li> {{/each}}</ul> {{else}} <p>{{error}}</p>{{/if}}对应适用json数据var data = { info:["HTML5","CSS3","WebGL"], "error":"数据取出错误"}这里{{#if}}判断是否存在list数组,如果存在则遍历list,如果不存在输出错误信息3.unless block helper{{#unless}}这个语法是反向的if语法也就是当判断的值为false时他会渲染DOM例如:{{#unless data}}<ul id="list"> {{#each list}} <li>{{this}}</li> {{/each}}</ul> {{else}} <p>{{error}}</p>{{/unless}}4.with block helper{{#with}}一般情况下,Handlebars模板会在编译的阶段的时候进行context传递和赋值。使用with的方法,我们可以将context转移到数据的一个section里面(如果你的数据包含section)。这个方法在操作复杂的template时候非常有用。<div class="entry"> <h1>{{title}}</h1> {{#with author}} <h2>By {{firstName}} {{lastName}}</h2> {{/with}}</div> 对应适用json数据{ title: "My first post!", author: { firstName: "Charles", lastName: "Jolley" }}Handlebar的注释(comments)Handlebars也可以使用注释写法如下{{! handlebars comments }}Handlebars的访问(Path)Handlebar支持路径和mustache,Handlebar还支持嵌套的路径,使得能够查找嵌套低于当前上下文的属性可以通过.来访问属性也可以使用../,来访问父级属性。例如:(使用.访问的例子)<h1>{{author.id}}</h1> 对应json数据{ title: "My First Blog Post!", author: { id: 47, name: "Yehuda Katz" }, body: "My first post. Wheeeee!" };例如:(使用../访问){{#with person}} <h1>{{../company.name}}</h1>{{/with}}对应适用json数据{ "person": { "name": "Alan" }, company: {"name": "Rad, Inc." }};自定义helperHandlebars,可以从任何上下文可以访问在一个模板,你可以使用Handlebars.registerHelper()方法来注册一个helper。调试技巧把下面一段"debug helper"加载到你的JavaScript代码里,然后在模板文件里通过{{debug}}或是{{debug someValue}}方便调试数据Handlebars.registerHelper("debug", function(optionalValue) { console.log("Current Context"); console.log("===================="); console.log(this); if (optionalValue) { console.log("Value"); console.log("===================="); console.log(optionalValue); }});handlebars的jquery插件(function($) { var compiled = {}; $.fn.handlebars = function(template, data) { if (template instanceof jQuery) { template = $(template).html(); } compiled[template] = Handlebars.compile(template); this.html(compiled[template](data)); };})(jQuery);$("#content").handlebars($("#template"), { name: "Alan" });