Skip to content

Commit

Permalink
Merge pull request #64 from avil13/dependabot/npm_and_yarn/example/lo…
Browse files Browse the repository at this point in the history
…dash-4.17.15

Bump lodash from 4.17.11 to 4.17.15 in /example
  • Loading branch information
avil13 authored Jul 25, 2019
2 parents 1abcb92 + 086c6f7 commit 9f2e775
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 28 deletions.
59 changes: 34 additions & 25 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ Vue.js wrapper for SweetAlert2. With support SSR.

## Get started


### Basics
```bash
npm install -S vue-sweetalert2
```
Expand All @@ -31,9 +31,32 @@ import 'sweetalert2/dist/sweetalert2.min.css';
Vue.use(VueSweetalert2);
```


Now in the global object, you can access all the methods of [sweetalert2](https://github.com/limonte/sweetalert2).

```html
// example-vue-component.vue
<template>
<button @click="showAlert">Hello world</button>
</template>

<script>
export default {
methods: {
showAlert(){
// Use sweetalert2
this.$swal('Hello Vue world!!!');
}
}
}
</script>
```

// Or
```js
Vue.swal('Hello Vue world!!!');
```

### Global options
If you want to add global options like button colors, do something like this:
```js
// main.js
Expand All @@ -47,8 +70,16 @@ const options = {

Vue.use(VueSweetalert2, options)
```

### Custom styling
Using scss styles are loaded so
```js
// main.js
import Vue from 'vue';
import VueSweetalert2 from 'vue-sweetalert2';

Vue.use(VueSweetalert2)
```

```scss
// style.scss
@import '~sweetalert2/src/variables';
Expand All @@ -61,28 +92,6 @@ $swal2-background: #990000;



```html
// example-vue-component.vue
<template>
<button @click="showAlert">Hello world</button>
</template>

<script>
export default {
methods: {
showAlert(){
// Use sweetalert2
this.$swal('Hello Vue world!!!');
}
}
}
</script>
```

// Or
```js
Vue.swal('Hello Vue world!!!');
```

## Nuxt.js

Expand Down
6 changes: 3 additions & 3 deletions example/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 9f2e775

Please sign in to comment.