11<template >
2- <div class =" btn-group " name =" HeaderSettings" >
3- <button class =" btn btn-default dropdown-toggle" ref =" dropdownBtn" type =" button" >
2+ <div class =" dropdown " name =" HeaderSettings" >
3+ <button data-toggle = " dropdown " class =" btn btn-default dropdown-toggle" ref =" dropdownBtn" type =" button" >
44 <i class =" fa" :class =" [usingBak && 'text-info', processingCls || 'fa-cog']" ></i >
55 <span class =" caret" ></span >
66 </button >
@@ -49,7 +49,6 @@ import groupBy from 'lodash/groupBy'
4949import keyGen from ' ../_utils/keyGen'
5050import replaceWith from ' ../_utils/replaceWith'
5151import { parseStr , stringify , saveToLS , rmFromLS , getFromLS } from ' ../_utils/localstorage'
52-
5352export default {
5453 name: ' HeaderSettings' ,
5554 components: { ColumnGroup },
@@ -68,10 +67,8 @@ export default {
6867 },
6968 created () {
7069 if (! this .supportBackup ) return
71-
7270 const backup = getFromLS (this .storageKey )
7371 if (! backup) return // no backup found
74-
7572 replaceWith (this .columns , backup)
7673 this .usingBak = true
7774 },
@@ -80,6 +77,7 @@ export default {
8077 const $el = $ (this .$el )
8178 $ (this .$refs .dropdownBtn ).on (' click' , this .toggle )
8279 $ (document ).on (' click' , e => {
80+ $ (e .target ).closest ($el).length || $el .removeClass (' show' ) // Bootstrap 4
8381 $ (e .target ).closest ($el).length || $el .removeClass (' open' )
8482 })
8583 },
@@ -114,11 +112,13 @@ export default {
114112 rmFromLS (this .storageKey )
115113 this .showProcessing ()
116114 this .usingBak = false
117-
115+
118116 replaceWith (this .columns , parseStr (this .origSettings )) // restore
119117 },
120118 toggle () {
119+ $ (this .$el ).toggleClass (' show' ) // Bootstrap 4
121120 $ (this .$el ).toggleClass (' open' )
121+ $ (this .$el ).find (' .dropdown-menu' ).toggleClass (' show' )
122122 },
123123 showProcessing () {
124124 [' fa-spinner fa-pulse' , ' fa-check' , ' ' ].forEach ((cls , idx ) => {
0 commit comments