delete template demo

This commit is contained in:
dntzhang 2017-03-22 16:22:34 +08:00
parent 936d91c712
commit d2d96b6f77
4 changed files with 0 additions and 3055 deletions

File diff suppressed because it is too large Load Diff

View File

@ -1,15 +0,0 @@
<!DOCTYPE html>
<html>
<head lang="en">
<meta charset="UTF-8">
<title></title>
</head>
<body>
<div id="test"></div>
<a href="https://github.com/AlloyTeam/omi" target="_blank" style="position: absolute; right: 0; top: 0;">
<img src="../../asset/github.png" alt="" />
</a>
<script src="https://unpkg.com/vue@2.2.4/dist/vue.min.js"></script>
<script src="bundler.js"></script>
</body>
</html>

View File

@ -1,47 +0,0 @@
import Omi from '../../src/index.js';
Omi.template = function(tpl, data){
var res = Vue.compile(tpl)
var v = new Vue({
el: document.createElement('div'),
data: data,
render: res.render,
staticRenderFns: res.staticRenderFns
});
var html = v.$el.outerHTML
v.$el = null;
v = null
res = null;
return html;
}
class List extends Omi.Component {
constructor(data) {
super(data);
}
style () {
return `
h1 { color:red; }
li{ color:green;}
`;
}
render () {
return `
<div>
<h1>{{title}}</h1>
<ul id="example-1">
<li v-for="item in items">
{{ item.message }}
</li>
</ul>
</div>
`;
}
}
export default List;

View File

@ -1,11 +0,0 @@
import List from './list.js';
let list = new List({
title:"aa",
items: [
{message: 'Foo' },
{message: 'Bar' }
]
});
Omi.render(list,'#test');