這種類型的繪制元素用于繪制任何文本。
這里是添加文本的簡(jiǎn)單語(yǔ)法。
xtype: 'draw',
type: 'text'
下面是一個(gè)簡(jiǎn)單的例子顯示用法。
<!DOCTYPE html>
<html>
<head>
<link href="./ext-6.0.0/build/classic/theme-classic/resources/theme-classic-all.css" rel="stylesheet" />
<script type="text/javascript" src="./ext-6.0.0/build/ext-all.js"></script>
<script type="text/javascript" src="./ext-6.0.0/build/packages/charts/classic/charts.js"></script>
<script type="text/javascript">
Ext.onReady(function() {
Ext.create({
xtype: 'draw',
renderTo: Ext.getBody(),
width: 600,
height: 200,
sprites: [{
type: 'text',
x: 200,
y: 100,
text: 'W3Cschool',
fontSize: 30,
fillStyle: 'orange'
}]
});
});
</script>
</head>
<body>
</body>
</html>
這將產(chǎn)生以下結(jié)果:
更多建議: