> For the complete documentation index, see [llms.txt](https://xiaolin.gitbook.io/vv-ui-plugins/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://xiaolin.gitbook.io/vv-ui-plugins/zhi-ling/layer.md).

# Layer

一个简单的 询问/提示 弹窗，通过 Promise 的方式调用，简单实用

## 如何使用

#### 询问模式

```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 %}
