Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

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

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!**