# ViewEvent

## 公共属性

* `type: string` - 事件类型（亦即，事件名称），例如：`enter` - 视图进入
* `timestamp: string` - 事件触发时间的时间戳
* `data: any`- 事件关联数据

## 宏观 beforechange 事件

**事件含义**

活动视图即将切换。

**发生对象**

`window.view`

**触发方式**

同步触发。

**关联数据**

[`ViewSwitchEventData`](/lei-xing/viewswitcheventdata.md)

## 宏观 change 事件

**事件含义**

活动视图正在切换。

**发生对象**

`window.view`

**触发方式**

同步触发。

**关联数据**

[`ViewSwitchEventData`](/lei-xing/viewswitcheventdata.md)

## 宏观 afterchange 事件

**事件含义**

活动视图切换完成。

**发生对象**

`window.view`

**触发方式**

异步触发。

**关联数据**

[`ViewSwitchEventData`](/lei-xing/viewswitcheventdata.md)

## 实例 beforeenter 事件

**事件含义**

视图即将进入。

**发生对象**

视图实例。

**触发方式**

同步触发。

**关联数据**

[`ViewInstanceEnterEventData`](/lei-xing/viewentereventdata.md)

## 实例 ready 事件

**事件含义**

视图就绪（第一次进入时触发）。

**发生对象**

视图实例。

**触发方式**

同步触发。

**关联数据**

[`ViewInstanceEnterEventData`](/lei-xing/viewentereventdata.md)

## 实例 enter 事件

**事件含义**

视图进入。

**发生对象**

视图实例。

**触发方式**

同步触发。

**关联数据**

[`ViewInstanceEnterEventData`](/lei-xing/viewentereventdata.md)

## 实例 afterenter 事件

**事件含义**

视图进入完成。

**发生对象**

视图实例。

**触发方式**

同步触发。

**关联数据**

[`ViewInstanceEnterEventData`](/lei-xing/viewentereventdata.md)

## 实例 leave 事件

**事件含义**

视图离开。

**发生对象**

视图实例。

**触发方式**

异步触发。

**关联数据**

[`ViewInstanceLeaveEventData`](/lei-xing/viewinstanceleaveeventdata.md)


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://api.view-js.com/lei-xing/viewevent.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
