Use swal.mixin

This commit is contained in:
Pig Fang 2018-07-31 10:37:34 +08:00
parent 7206f5952b
commit 21dfb21c41
4 changed files with 9 additions and 10 deletions

View File

@ -21,7 +21,7 @@
</template>
<script>
import swal from 'sweetalert2';
import { swal } from '../../js/notify';
import toastr from 'toastr';
import axios from 'axios';

View File

@ -4,13 +4,6 @@ import 'bootstrap-fileinput';
import 'admin-lte';
import 'icheck';
import Vue from 'vue';
import swal from 'sweetalert2';
import { trans } from './i18n';
swal.setDefaults({
confirmButtonText: trans('general.confirm'),
cancelButtonText: trans('general.cancel')
});
Vue.mixin({
mounted() {

View File

@ -1,4 +1,5 @@
import $ from 'jquery';
import sweetalert2 from 'sweetalert2';
import { trans } from './i18n';
/**
@ -71,3 +72,8 @@ export function showModal(msg, title = 'Message', type = 'default', options = {}
destroyOnClose && $(this).remove();
}).modal(options);
}
export const swal = sweetalert2.mixin({
confirmButtonText: trans('general.confirm'),
cancelButtonText: trans('general.cancel')
});

View File

@ -1,10 +1,10 @@
import { mount } from '@vue/test-utils';
import ClosetItem from '@/user/ClosetItem';
import axios from 'axios';
import swal from 'sweetalert2';
import { swal } from '@/../js/notify';
jest.mock('axios');
jest.mock('sweetalert2');
jest.mock('@/../js/notify');
function factory(opt = {}) {
return {