Giter Site home page Giter Site logo

test's Introduction

panda.xiong

ghjs 模板引擎 测试版 beta 1.0

基于angularJs 精简出来的一个模板引擎。改变了传统模板引擎以"< >"或"{ }"作为语法指令的模式,使用自定义的html的属性作为引擎的语法,使html文件的结构更好的呈现,而不会被引擎所破坏。

本引擎结合了jquery插件使用,通过 var template =$("#id").template()或$.template($("#id"))就可以改变html结构,然后通过返回的template函数,直接调用template(context),context是数据仓库,一个js对象,就可以给该模板填值。

本引擎也提供了接口让使用者可自定义字符串解析器和语法指令,用以自己解析特殊的html结构。

用法指南: 指令:指令就是一个html的属性,目前也只支持属性,通过自定义属性可以控制该所属节点的html结构,可为它生成所需的html结构。 1.gh-repeat -- 循环指令,循环显示所在元素和它的子元素们。 2.gh-text -- 显示scope里面的值 3.gh-show -- 通过变量判断是否显示该元素 4.gh-if -- 通过变量判断是否从页面上移除该元素 服务:模板所需的其它功能采用注入的方式使用,而不会污染其它全局变量。

  1. interpolate: 可注入此服务替代系统内置的服务,用于解析{ xxx}括号里的内容

定义方式:可看test目录下的 template.js。

本文档后续完善,多谢支持......

test's People

Contributors

tangpo avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.