Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/lin-xi/rv
jsx render library
https://github.com/lin-xi/rv
Last synced: 15 days ago
JSON representation
jsx render library
- Host: GitHub
- URL: https://github.com/lin-xi/rv
- Owner: lin-xi
- Created: 2017-03-07T11:12:09.000Z (almost 8 years ago)
- Default Branch: master
- Last Pushed: 2017-03-07T11:42:44.000Z (almost 8 years ago)
- Last Synced: 2024-11-11T09:44:36.490Z (2 months ago)
- Language: JavaScript
- Size: 9.77 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Rv
a JSX render library with regex
### Todo Components
```
export default {
data(){
let events = [];
for(let i=0; i< 20; i++){
events.push({id: i, todo: `JSX编译库-${i}`, state: i%2 ? 1 : 2})
}
return {
events: events,
dateTime: new Date().toLocaleString().replace(/[\u4e00-\u9fa5]/g, '')
}
},
created(){},
mounted(){},
render(){
return `
{this.dateTime} - todo
{
if(this.events.length > 0){
this.events.map(item => {
if(item.state == 2){
return- {item.todo}
} else {
return- {item.todo}
}
})
} else if(this.events.length == 0){
return '暂无数据';
}
}
`
},
methods: {
itemClick(e){}
}
}
```### Render
```
import Todo from './components/Todo';
let dom = document.querySelector('#app');Rv.render(Todo, {}, dom);
```> **just for fun!**
> **please don't use in production, or you'll be fired!**