Skip to content

Commit

Permalink
fix #50
Browse files Browse the repository at this point in the history
  • Loading branch information
avil13 committed May 14, 2019
1 parent 0b4182b commit f09b5c6
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 12 deletions.
1 change: 0 additions & 1 deletion example/src/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ Vue.use
export default class AppComponent extends Vue {
msg: string = 'Welcome to Vue-Sweetalert2 example'
simple() {
this.$swal('Hello world!');
}
Expand Down
10 changes: 6 additions & 4 deletions example/webpack.config.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
var path = require('path')
var webpack = require('webpack')
var HtmlWebpackPlugin = require('html-webpack-plugin')
const path = require('path')
const webpack = require('webpack')
const HtmlWebpackPlugin = require('html-webpack-plugin')
const UglifyJsPlugin = require('uglifyjs-webpack-plugin');
const { VueLoaderPlugin } = require('vue-loader')

var is_production = (process.env.NODE_ENV === 'production');
// const is_production = (process.env.NODE_ENV === 'production');
const is_production = false; // for DEMO

module.exports = {
entry: './src/main.ts',
Expand All @@ -14,6 +15,7 @@ module.exports = {
filename: 'build.js'
},
mode: is_production ? 'production' : 'development',
devtool: is_production ? false : 'cheap-eval-source-map',
module: {
rules: [
// Vue
Expand Down
10 changes: 3 additions & 7 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,17 +28,13 @@ class VueSweetalert2 {
...options
};

if (options.includeCss === false) {
if (options.includeCss !== false) {
require('sweetalert2/dist/sweetalert2.min.css');
}

// adding a global method or property
let _swal: VueSwalInstance;

_swal = options ? Swal.mixin(options).fire.bind(Swal) : Swal.fire.bind(Swal);

// Object.assign(_swal, Swal);
const _swal = options ? Swal.mixin(options).fire.bind(Swal) : Swal.fire.bind(Swal);

// adding a global method or property
Vue['swal'] = _swal;

// add the instance method
Expand Down

0 comments on commit f09b5c6

Please sign in to comment.