---
name: "movable-area"
mode: "component"
versionRequirements:
  - { name: "基础库", version: "2.10.0" }
title: "movable-area - movable-view 的可移动区域"
---

## movable-area

> [VERSION] 基础库 >= 2.10.0

### 描述

可移动区域容器，搭配 movable-view 使用。

### 属性

| 属性 | 类型 | 必填 | 默认值 | 描述 |
| --- | --- | --- | --- | --- |
| `scale-area` | `boolean` | 否 | `false` | 当里面的 movable-view 设置为支持双指缩放时，设置此值可将缩放手势生效区域修改为整个 movable-area |

### 示例代码

#### 基础用法

*index.tyml*

```xml
<movable-area style="width:300px;height:300px;">
  <movable-view direction="all" x="0" y="0" style="width:80px;height:80px;">拖动</movable-view>
</movable-area>
```

*index.tyss*

```css
movable-area {
  background-color: #f5f5f5;
}
movable-view {
  background-color: #1989fa;
  color: #fff;
  text-align: center;
  line-height: 80px;
}
```

*index.js*

```javascript
Page({});
```

#### 缩放模式

*index.tyml*

```xml
<movable-area scale-area style="width:300px;height:300px;">
  <movable-view direction="all" scale scale-min="0.5" scale-max="4" style="width:80px;height:80px;">缩放</movable-view>
</movable-area>
```

*index.tyss*

```css
movable-area {
  background-color: #f5f5f5;
}
movable-view {
  background-color: #1989fa;
  color: #fff;
  text-align: center;
  line-height: 80px;
}
```

*index.js*

```javascript
Page({});
```
