From b2af2c4cd51b48a460cfa4c5796f2ddb54b06247 Mon Sep 17 00:00:00 2001 From: Anlige Date: Sun, 6 Aug 2017 23:30:06 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E9=87=8D=E6=95=B4=E7=9B=AE=E5=BD=95?= =?UTF-8?q?=E7=BB=93=E6=9E=84=EF=BC=9B=20=E6=89=A9=E5=B1=95AJAX=E4=B8=A4?= =?UTF-8?q?=E4=B8=AA=E6=96=B9=E6=B3=95=EF=BC=9Arequire=E5=92=8Cnext?= =?UTF-8?q?=EF=BC=9B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- demo/demo.css | 5 ++ demo/demo.js | 15 ++++ extends.html => demo/extends.html | 22 +++--- htmlhelper.html => demo/htmlhelper.html | 18 ++--- demo.html => demo/index.html | 20 +++--- layouts.html => demo/layouts.html | 0 index.html | 24 ++++--- src/pithy.ajax.js | 93 +++++++++++++++++++++++++ src/pithy.teemplate.extends.js | 5 ++ src/pithy.teemplate.helper.js | 13 +++- src/pithy.teemplate.js | 5 ++ 11 files changed, 176 insertions(+), 44 deletions(-) create mode 100644 demo/demo.css create mode 100644 demo/demo.js rename extends.html => demo/extends.html (58%) rename htmlhelper.html => demo/htmlhelper.html (70%) rename demo.html => demo/index.html (64%) rename layouts.html => demo/layouts.html (100%) diff --git a/demo/demo.css b/demo/demo.css new file mode 100644 index 0000000..e2c80ef --- /dev/null +++ b/demo/demo.css @@ -0,0 +1,5 @@ +/*! + +*/ + +a{color: blue; text-decoration: underline;cursor:pointer} \ No newline at end of file diff --git a/demo/demo.js b/demo/demo.js new file mode 100644 index 0000000..778a7b6 --- /dev/null +++ b/demo/demo.js @@ -0,0 +1,15 @@ +/*! +demo +*/ +;(function(){ + + function __initlize(){ + document.getElementById('nav-list').innerHTML = + '在线测试工具 '+ + '基本示例 '+ + 'PjtHtmlhelper '+ + 'PjtExtends'; + } + + on(window, 'load', __initlize); +})(); \ No newline at end of file diff --git a/extends.html b/demo/extends.html similarity index 58% rename from extends.html rename to demo/extends.html index e1797a8..0b65e2b 100644 --- a/extends.html +++ b/demo/extends.html @@ -3,17 +3,17 @@ - - - - + + + + - Pithy.js.teemplate / extends Demo - + Pithy.js.teemplate / extends / Demo + +

PjtExtends示例

+

PjtExtends需要引用pithy.teemplate.extends.js文件

任课教师 学习成绩
\ No newline at end of file diff --git a/htmlhelper.html b/demo/htmlhelper.html similarity index 70% rename from htmlhelper.html rename to demo/htmlhelper.html index 0ac30d9..75ef782 100644 --- a/htmlhelper.html +++ b/demo/htmlhelper.html @@ -3,19 +3,18 @@ - - - + + + + + Pithy.js.teemplate / htmlhelper / Demo - +

PjtHtmlhelper示例

+

PjtExtends需要引用pithy.teemplate.htmlhelper.js文件,文件引用后即自动扩展,不需要调用任何方法

渲染结果

@@ -30,7 +29,8 @@ var codes = Pjt.compile(id('_template').innerHTML); id('result').innerHTML = Pjt.render(codes, data); } - on(window, 'load', __initlize); + + AJAX.require('../src/pithy.teemplate.htmlhelper.js', __initlize); - - + + + + Pithy.js.teemplate / Demo - +

Pjt示例

渲染结果

@@ -34,10 +31,9 @@ works : 9 } }; - function __initlize(){ - PjtHelper.bind(data, '_template', 'result'); - } - on(window, 'load', __initlize); + AJAX.require('../src/pithy.teemplate.helper.js', function(helper){ + helper.bind(data, '_template', 'result'); + }); + - Pithy.js.teemplate