init container
This commit is contained in:
		
							
								
								
									
										6
									
								
								.gitignore
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										6
									
								
								.gitignore
									
									
									
									
										vendored
									
									
										Normal file
									
								
							| @@ -0,0 +1,6 @@ | |||||||
|  | node_modules | ||||||
|  | dist | ||||||
|  | build | ||||||
|  | .cache | ||||||
|  | .DS_Store | ||||||
|  | *.log | ||||||
							
								
								
									
										29
									
								
								readme.md
									
									
									
									
									
								
							
							
						
						
									
										29
									
								
								readme.md
									
									
									
									
									
								
							| @@ -1,10 +1,27 @@ | |||||||
| # Container | # Container | ||||||
|  |  | ||||||
| ```js | ```js | ||||||
|   const container = new Container({ | import { Container } from 'https://kevisual.xiongxiao.me/system/lib/container.js'; | ||||||
|     root: '#cid", | const data = [ | ||||||
|     data: data, |   { | ||||||
|     showChild: false, |     id: 'base-root', | ||||||
|   }); |     code: { | ||||||
|   container.renderChildren('node-1'); |       render: (ctx) => { | ||||||
|  |         const rootEl = ctx.renderRoot; | ||||||
|  |         const div = document.createElement('div'); | ||||||
|  |         div.innerHTML = 'Hello World!'; | ||||||
|  |         rootEl.appendChild(div); | ||||||
|  |       }, | ||||||
|  |       unmount: (ctx) => { | ||||||
|  |         console.log('unmount'); | ||||||
|  |       }, | ||||||
|  |     }, | ||||||
|  |   }, | ||||||
|  | ]; | ||||||
|  | const container = new Container({ | ||||||
|  |   root: 'root', | ||||||
|  |   data: data, | ||||||
|  | }); | ||||||
|  | container.render('base-root'); | ||||||
| ``` | ``` | ||||||
|  |  | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user