mirror of
https://github.com/tusen-ai/naive-ui.git
synced 2024-12-09 04:31:35 +08:00
Merge branch 'master' of github.com:07akioni/naive-ui
This commit is contained in:
commit
5d635ed12b
@ -1,28 +1,32 @@
|
||||
# Async
|
||||
|
||||
```html
|
||||
<n-button @click="handleClick">
|
||||
Success
|
||||
</n-button>
|
||||
```
|
||||
|
||||
```css
|
||||
.n-button {
|
||||
margin: 0 12px 8px 0;
|
||||
}
|
||||
```
|
||||
|
||||
```js
|
||||
export default {
|
||||
methods: {
|
||||
handleClick (e) {
|
||||
handleClick(e) {
|
||||
const confirmInstance = this.$NModal.success({
|
||||
title: "Success",
|
||||
content:
|
||||
"Premium designed icons for use in web, iOS, Android, and desktop apps. Support for SVG and web font. Completely open source, MIT licensed and built by the Ionic Framework team.",
|
||||
onPositiveClick: (hide) => {
|
||||
onPositiveClick: hide => {
|
||||
confirmInstance.loading = true;
|
||||
this.$NMessage.success("count down 1 second");
|
||||
window.setTimeout(hide, 1000)
|
||||
window.setTimeout(hide, 1000);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
};
|
||||
```
|
||||
```
|
||||
|
@ -47,12 +47,13 @@
|
||||
:theme="theme"
|
||||
round
|
||||
:disabled="loading === true"
|
||||
:loading="loading"
|
||||
size="small"
|
||||
type="primary"
|
||||
auto-text-color
|
||||
@click="handlePositiveClick"
|
||||
>
|
||||
{{ loading === true ? "Loading" : positiveText }}
|
||||
{{positiveText}}
|
||||
</n-button>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -1,4 +1,3 @@
|
||||
|
||||
import Confirm from './confirm.vue'
|
||||
|
||||
const instances = new Set()
|
||||
@ -23,30 +22,42 @@ export default {
|
||||
},
|
||||
confirm (options) {
|
||||
const instance = this.createInstance()
|
||||
setDataOnConfirmInstance({
|
||||
type: 'confirm',
|
||||
active: true,
|
||||
theme: this.theme,
|
||||
...options
|
||||
}, instance)
|
||||
setDataOnConfirmInstance(
|
||||
{
|
||||
type: 'confirm',
|
||||
active: true,
|
||||
theme: this.theme,
|
||||
...options
|
||||
},
|
||||
instance
|
||||
)
|
||||
return instance
|
||||
},
|
||||
error (options) {
|
||||
const instance = this.createInstance()
|
||||
setDataOnConfirmInstance({
|
||||
type: 'error',
|
||||
active: true,
|
||||
theme: this.theme,
|
||||
...options
|
||||
}, instance)
|
||||
setDataOnConfirmInstance(
|
||||
{
|
||||
type: 'error',
|
||||
active: true,
|
||||
theme: this.theme,
|
||||
...options
|
||||
},
|
||||
instance
|
||||
)
|
||||
return instance
|
||||
},
|
||||
success (options) {
|
||||
const instance = this.createInstance()
|
||||
setDataOnConfirmInstance({
|
||||
type: 'success',
|
||||
active: true,
|
||||
theme: this.theme,
|
||||
...options
|
||||
}, instance)
|
||||
setDataOnConfirmInstance(
|
||||
{
|
||||
type: 'success',
|
||||
active: true,
|
||||
theme: this.theme,
|
||||
...options
|
||||
},
|
||||
instance
|
||||
)
|
||||
return instance
|
||||
},
|
||||
destroyAll () {
|
||||
instances.forEach(instance => {
|
||||
|
Loading…
Reference in New Issue
Block a user