[Improment] add $toast/$dialog to Vue.prototype (#363)

This commit is contained in:
neverland
2017-11-30 14:52:19 +08:00
committed by GitHub
parent 121e2de375
commit c23762e08b
13 changed files with 153 additions and 86 deletions
+2 -2
View File
@@ -35,8 +35,8 @@ Vue.component(Button.name, Button);
#### Loading
```html
<van-button loading></van-button>
<van-button loading type="primary"></van-button>
<van-button loading />
<van-button loading type="primary" />
```
#### Custom Tag
+13
View File
@@ -40,6 +40,19 @@ Used to confirm some messages, including a confirm button and a cancel button
});
```
#### $dialog Method
After import the Dialog component, the $dialog method is automatically mounted on Vue.prototype, making it easy to call within a vue component.
```js
export default {
mounted() {
this.$dialog.alert({
message: 'Content'
});
}
}
```
### Methods
| Name | Attribute | Return value | Description |
+11
View File
@@ -51,6 +51,17 @@ const timer = setInterval(() => {
}, 1000);
```
#### $toast Method
After import the Toast component, the $toast method is automatically mounted on Vue.prototype, making it easy to call within a vue component.
```js
export default {
mounted() {
this.$toast('Some messages');
}
}
```
### Methods
| Methods | Attribute | Return value | Description |