blockml component
1.0.0
ระบบที่ใช้ส่วนประกอบที่มี DOM เสมือนสำหรับ blockML (ภาษาง่าย ๆ ที่สร้าง HTML) มันคล้ายกับปฏิกิริยาและเชิงมุม แต่ตั้งใจจะง่ายที่สุดเท่าที่จะทำได้
ตัวอย่างการใช้งาน:
var blockml = require('blockml');
blockml.component = require('blockml-component');
blockml.component('Page', {
render: function (props, children) {
return blockml`
div {
${children}
}
`;
}
});
// a custom "App" component that we can use in our code
blockml.component('App', {
render: function (props, children) {
return blockml`
Page {
h1 {
"Hello World"
}
${children}
}
`;
}
});
// this will hold the rendered html
var html = blockml.render(`
html {
head;
body {
App {
h1 {
"Hello"
}
}
}
}
`);