Merge branch 'master' of github.com:07akioni/naive-ui

This commit is contained in:
07akioni 2019-10-22 18:46:40 +08:00
commit 5d635ed12b
3 changed files with 40 additions and 24 deletions

View File

@ -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);
}
});
}
}
};
```
```

View File

@ -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>

View File

@ -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 => {