11# DOM Renderer
22
3- ** Template engine** based on ** HTML 5** & ** ECMAScript 6**
3+ ** Template engine** based on ** HTML 5** , ** ECMAScript 6** & ** MVVM **
44
55[ ![ NPM Dependency] ( https://david-dm.org/EasyWebApp/DOM-Renderer.svg )] ( https://david-dm.org/EasyWebApp/DOM-Renderer )
66[ ![ Build Status] ( https://travis-ci.com/EasyWebApp/DOM-Renderer.svg?branch=master )] ( https://travis-ci.com/EasyWebApp/DOM-Renderer )
2727}
2828```
2929
30- [ ` source/index.html ` ] ( https://github.com/EasyWebApp/ DOM-Renderer/blob/master/test/source/index .html )
30+ ` source/index.html ` [ ** Template syntax ** ] ( https://web-cell/ DOM-Renderer/manual/Template .html )
3131
3232``` HTML
3333<template >
4949 <li >${view.title}</li >
5050 </template >
5151 </ol >
52+
53+ <input type =" text" name =" name" placeholder =" Switch account" >
5254</template >
5355```
5456
@@ -60,7 +62,7 @@ import View, { parseDOM } from 'dom-renderer';
6062import template from ' ./index.html' ;
6163import data from ' ./index.json' ;
6264
63- const view = new View ( parseDOM ( template ). firstChild . innerHTML );
65+ const view = new View ( View . getTemplate ( parseDOM ( template ) ) );
6466
6567view .render ( data ).then (() => console .log (view + ' ' ));
6668```
@@ -89,6 +91,8 @@ view.render( data ).then(() => console.log(view + ''));
8991 <li >MVP</li >
9092 <li >KaiYuanShe</li >
9193</ol >
94+
95+ <input type =" text" name =" name" placeholder =" Switch account" >
9296```
9397
9498## Installation
@@ -115,10 +119,7 @@ import View from 'dom-renderer';
115119## Compile & bundle
116120
117121``` Shell
118- npm install -D \
119- web-cell \
120- @babel/preset-env \
121- babel-plugin-inline-import
122+ npm install web-cell-cli @babel/preset-env -D
122123```
123124
124125` package.json `
@@ -134,18 +135,6 @@ npm install -D \
134135 "babel" : {
135136 "presets" : [
136137 " @babel/preset-env"
137- ],
138- "plugins" : [
139- [
140- " babel-plugin-inline-import" ,
141- {
142- "extensions" : [
143- " .html" ,
144- " .css" ,
145- " .json"
146- ]
147- }
148- ]
149138 ]
150139 }
151140}
@@ -198,4 +187,4 @@ nextTick().then(() => {
198187
199188## Typical cases
200189
201- https://www.npmjs.com/browse/depended/dom-renderer
190+ 1 . [ WebCell ] ( https://web-cell.tk/ )
0 commit comments