# Layer

## 如何使用

#### 询问模式

```javascript
this.$confirm({
  msg: '弹窗提示信息',
  title: '弹窗标题头',
  cancelTXT: '取消按钮文案',
  sureTXT: '确定按钮文案'
}).then((res) => {
  // 点击确定后执行逻辑
}).catch((err) => {
  // 点击取消后执行逻辑
})
```

#### 提示模式

```javascript
this.$confirm({
  msg: '弹窗提示信息',
  title: '弹窗标题头',
  sureTXT: '确定按钮文案'
}).then((res) => {
  // 点击确定后执行逻辑
}).catch((err) => {
  // 点击取消后执行逻辑
})
```

## 参数说明

| msg       | 弹窗内容，默认值为 ""     |
| --------- | ---------------- |
| title     | 弹窗标题，默认值为 "提示"   |
| sureTXT   | 确认按钮文案，默认值为 "确认" |
| cancelTXT | 取消按钮文案，默认值为 "取消" |

{% hint style="info" %}
询问模式和提示模式，区别仅仅为提示模式，没有取消按钮，并且两种模式，点击外层半透明浮层都会进去取消逻辑，这一点请注意，因为本人并没有引入 Promise 的 Polyfill
{% endhint %}


---

# 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://xiaolin.gitbook.io/vv-ui-plugins/zhi-ling/layer.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.
