From 0423bef836d4e374a905c9bf1e24288a3c73f25d Mon Sep 17 00:00:00 2001 From: Pig Fang Date: Tue, 31 Jul 2018 09:16:56 +0800 Subject: [PATCH] Fix running jQuery plugins --- resources/assets/src/js/layout.js | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/resources/assets/src/js/layout.js b/resources/assets/src/js/layout.js index 3cc1ffc9..dc63422d 100644 --- a/resources/assets/src/js/layout.js +++ b/resources/assets/src/js/layout.js @@ -3,3 +3,33 @@ import 'bootstrap'; 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() { + $(this.$el).iCheck({ + radioClass: 'iradio_square-blue', + checkboxClass: 'icheckbox_square-blue' + }).on('ifChecked ifUnchecked', function () { + $(this)[0].dispatchEvent(new Event('change')); + }); + + $('[data-toggle="tooltip"]').tooltip(); + } +}); + +$(document).ready(() => { + $('input').iCheck({ + radioClass: 'iradio_square-blue', + checkboxClass: 'icheckbox_square-blue' + }); + + $('[data-toggle="tooltip"]').tooltip(); +});