init container

This commit is contained in:
xion 2024-10-16 23:14:53 +08:00
parent e4b62ee40a
commit eeb78110db
2 changed files with 29 additions and 6 deletions

6
.gitignore vendored Normal file
View File

@ -0,0 +1,6 @@
node_modules
dist
build
.cache
.DS_Store
*.log

View File

@ -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');
``` ```