Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
Алексей Пивкин committed Jun 28, 2019
1 parent 8f385d7 commit 1837dab
Show file tree
Hide file tree
Showing 4 changed files with 44 additions and 30 deletions.
39 changes: 13 additions & 26 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ 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).

If you want to add global options like button colors, do something like this:
Expand All @@ -47,6 +48,18 @@ const options = {
Vue.use(VueSweetalert2, options)
```

Using scss styles are loaded so
```scss
// style.scss
@import '~sweetalert2/src/variables';

$swal2-background: #990000;

@import '~sweetalert2/src/sweetalert2';
```




```html
// example-vue-component.vue
Expand Down Expand Up @@ -107,29 +120,3 @@ Or pass in global options like this:
## The documentation for `sweetalert2`, you can find [here](https://sweetalert2.github.io/).
---
# Additional options
In some cases, there was a need to expand sweetalert2. And added more options.
| options | type | default |
|--- |--- |--- |
| [includeCss](#includecss) | boolean | true |
#### includeCss
```js
// main.js | main.ts
Vue.use(VueSweetalert2, { includeCss: false });
```
```scss
// style.scss
@import '~sweetalert2/src/variables';

$swal2-background: #990000;

@import '~sweetalert2/src/sweetalert2';
```
21 changes: 21 additions & 0 deletions example/.vscode/launch.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [{
"type": "node",
"request": "launch",
"name": "webpack-dev-server",
"program": "${workspaceFolder}/node_modules/.bin/webpack-dev-server",
"outFiles": [
"${workspaceFolder}/**/*.js"
],
"args": [
"--hot"
],
"env": {
"NODE_ENV": "development"
}
}]
}
4 changes: 1 addition & 3 deletions example/src/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -24,17 +24,15 @@

<script lang="ts">
// import Vue from 'vue';
// import Component from 'vue-class-component';
import { Component, Vue } from 'vue-property-decorator';
Vue.use
@Component
export default class AppComponent extends Vue {
msg: string = 'Welcome to Vue-Sweetalert2 example'
simple() {
this.$swal('Hello world!');
debugger;
}
// /*
success() {
Expand Down
10 changes: 9 additions & 1 deletion example/src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,15 @@ import App from './App.vue';

import VueSweetalert2 from './vue-sweetalert2';

Vue.use(VueSweetalert2, { includeCss: true });
Vue.use(VueSweetalert2, {
// options
buttonsStyling: false,
animation: false,
customClass: {
confirmButton: 'btn btn-primary',
cancelButton: 'btn btn-warning',
}
});

new Vue({
el: '#app',
Expand Down

0 comments on commit 1837dab

Please sign in to comment.