mirror of
https://github.com/tusen-ai/naive-ui.git
synced 2024-12-27 05:00:48 +08:00
34 lines
574 B
Markdown
34 lines
574 B
Markdown
# 异步
|
|
确认可以异步。
|
|
```html
|
|
<n-button @click="handleClick">
|
|
成功
|
|
</n-button>
|
|
```
|
|
|
|
```css
|
|
.n-button {
|
|
margin: 0 12px 8px 0;
|
|
}
|
|
```
|
|
|
|
```js
|
|
export default {
|
|
methods: {
|
|
handleClick(e) {
|
|
const confirmInstance = this.$NConfirm.success({
|
|
title: '异步',
|
|
content:
|
|
'点击,倒计时 3 秒',
|
|
positiveText: '确认',
|
|
onPositiveClick: hide => {
|
|
confirmInstance.loading = true
|
|
this.$NMessage.success('倒计时 3 秒')
|
|
window.setTimeout(hide, 3000)
|
|
}
|
|
})
|
|
}
|
|
}
|
|
}
|
|
```
|