---
title: "Ext.draw.Text"
description: "xtype 为 text 的 Ext JS 原生组件参考。"
---

> Documentation Index
> Fetch the complete documentation index at: https://ag.879818327.xyz/llms.txt
> Use this file to discover all available pages before exploring further.

# Ext.draw.Text

源码定义：`ext-all-debug.js:88644`。分类：图表与绘图。

## 创建示例

```javascript
var component = Ext.create("Ext.draw.Text", {
  xtype: "text",
  autoSize: true,
  baseCls: Ext.baseCSSPrefix + 'surface ' + Ext.baseCSSP...,
  focusable: false,
  text: '',
  renderTo: Ext.getBody()
});
```

## 属性

| 属性 | 类型 | 默认值 | 说明 | 配置示例 |
| --- | --- | --- | --- | --- |
| `autoSize` | `Boolean` | `true` | 控制是否启用 `autoSize` 行为。 | `autoSize: true` |
| `baseCls` | `Mixed` | `Ext.baseCSSPrefix + 'surface ' + Ext.baseCSSP...` | 配置 `baseCls` 对应的 CSS 类名。 | `baseCls: Ext.baseCSSPrefix + 'surface ' + Ext.baseCSSP...` |
| `focusable` | `Boolean` | `false` | 控制是否启用 `focusable` 行为。 | `focusable: false` |
| `text` | `String` | `''` | 配置组件的 `text` 选项。 | `text: ''` |
| `viewBox` | `Boolean` | `false` | 控制是否启用 `viewBox` 行为。 | `viewBox: false` |

## 方法

| 方法 | 参数 | 说明 | 调用示例 |
| --- | --- | --- | --- |
| `initComponent` | `` | 初始化组件及其子项。 执行时会保留父类默认行为、更新 `textConfig` 状态。源码涉及 `getStyles()`、`callParent()`。 | `component.initComponent()` |
| `getStyles` | `selectors` | 读取并返回 `styles`。 | `component.getStyles(...)` |
| `setAngle` | `degrees` | 设置 `angle`。 执行时会刷新界面或布局、更新 `degrees` 状态。源码涉及 `updateLayout()`。 | `component.setAngle(...)` |
| `setText` | `text` | 设置 `text`。 执行时会刷新界面或布局、更新 `text` 状态。源码涉及 `updateLayout()`、`on()`。 | `component.setText(...)` |

## 事件

源码中未找到该组件自身注册的事件；可监听继承事件。

Source: https://ag.879818327.xyz/ext/visual/draw-text/index.mdx
