widgets/index.js
2024-05-16 06:46:41 +08:00

11 lines
375 B
JavaScript

import { div, span, pre } from './main.js'
document.body.appendChild(div.w(128).h(64).childs([
span.m('2rem').p({ top: '2rem' }).text('Hello world!'),
new span({ textContent: 'Hello world!' }),
]))
fetch('/index.js').then(res => res.text()).then(text => {
document.body.appendChild(pre.p('2rem').bg('#ececec').text(text.substring(0, text.indexOf('fetch'))))
})