var component1 = Ext.create('Ext.Component', {
html:'First Component'
});
Ext.create('Ext.container.Container', {
renderTo: Ext.getBody(),
items: [component1]
});
您可以將組件作為容器中的項目<!DOCTYPE html>
<html>
<head>
<link href="./ext-6.0.0/build/classic/theme-classic/resources/theme-classic-all.css" rel="stylesheet">
<script src="./ext-6.0.0/build/ext-all.js"></script>
<script type="text/javascript">
Ext.onReady(function () {
var component1 = Ext.create("Ext.Component", {
html: "First Component",
});
var component2 = Ext.create("Ext.Component", {
html: "Second Component",
});
var component3 = Ext.create("Ext.Component", {
html: "Third Component",
});
Ext.create("Ext.container.Container", {
renderTo: Ext.getBody(),
title: "Container",
border: 1,
width: "50%",
style: { borderStyle: "solid", borderWidth: "2px" },
items: [component1, component2, component3],
});
});
</script>
</head>
<body></body>
</html>
這將產(chǎn)生以下結(jié)果:
更多建議: